Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pthread_shared_mem.h
Go to the documentation of this file.
1 // Copyright 2011 Google Inc.
16 
17 #ifndef PAGESPEED_KERNEL_THREAD_PTHREAD_SHARED_MEM_H_
18 #define PAGESPEED_KERNEL_THREAD_PTHREAD_SHARED_MEM_H_
19 
20 #include <cstddef>
21 #include <map>
22 #include <utility>
23 
27 
28 namespace net_instaweb {
29 class MessageHandler;
30 
39  public:
41  virtual ~PthreadSharedMem();
42 
43  virtual size_t SharedMutexSize() const;
44 
46  const GoogleString& name, size_t size, MessageHandler* handler);
47 
49  const GoogleString& name, size_t size, MessageHandler* handler);
50 
51  virtual void DestroySegment(const GoogleString& name,
52  MessageHandler* handler);
53 
55  static void Terminate();
56 
57  private:
58  typedef std::map<GoogleString, std::pair<char*, size_t> > SegmentBaseMap;
59 
61  static SegmentBaseMap* AcquireSegmentBases();
62 
63  static void UnlockSegmentBases();
64 
66  GoogleString PrefixSegmentName(const GoogleString& name);
67 
71  static SegmentBaseMap* segment_bases_;
72 
74  static size_t s_instance_count_;
79  size_t instance_number_;
80 
81 
82 };
83 
84 }
85 
86 #endif
virtual size_t SharedMutexSize() const
Size of mutexes inside shared memory segments.
virtual void DestroySegment(const GoogleString &name, MessageHandler *handler)
virtual AbstractSharedMemSegment * CreateSegment(const GoogleString &name, size_t size, MessageHandler *handler)
Definition: pthread_shared_mem.h:38
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: abstract_shared_mem.h:86
virtual AbstractSharedMemSegment * AttachToSegment(const GoogleString &name, size_t size, MessageHandler *handler)
static void Terminate()
Frees all lazy-initialized memory used to track shared-memory segments.
Definition: message_handler.h:39
Definition: abstract_shared_mem.h:31