Page Speed Optimization Libraries
1.4.26.1
|
#include "inprocess_shared_mem.h"
Public Member Functions | |
InProcessSharedMem (ThreadSystem *thread_system) | |
Does not take ownership of thread_system. | |
virtual size_t | SharedMutexSize () const |
virtual AbstractSharedMemSegment * | CreateSegment (const GoogleString &name, size_t size, MessageHandler *handler) |
virtual AbstractSharedMemSegment * | AttachToSegment (const GoogleString &name, size_t size, MessageHandler *handler) |
virtual void | DestroySegment (const GoogleString &name, MessageHandler *handler) |
This class emulates the normally cross-process shared memory API within a single process on top of threading APIs, in order to permit deploying classes built for shared memory into single-process servers or tests. Note, however, that a direct implementation taking advantage of much simpler in-process programming model may be far superior.
virtual AbstractSharedMemSegment* net_instaweb::InProcessSharedMem::AttachToSegment | ( | const GoogleString & | name, |
size_t | size, | ||
MessageHandler * | handler | ||
) | [virtual] |
Attaches to an existing segment, which must have been created already. May return NULL on failure
Implements net_instaweb::AbstractSharedMem.
virtual AbstractSharedMemSegment* net_instaweb::InProcessSharedMem::CreateSegment | ( | const GoogleString & | name, |
size_t | size, | ||
MessageHandler * | handler | ||
) | [virtual] |
This should be called upon main process/thread initialization to create a shared memory segment that will be accessed by other processes/threads as identified by a unique name (via AttachToSegment). It will remove any previous segment with the same name. The memory will be zeroed out.
May return NULL on failure.
Implements net_instaweb::AbstractSharedMem.
virtual void net_instaweb::InProcessSharedMem::DestroySegment | ( | const GoogleString & | name, |
MessageHandler * | handler | ||
) | [virtual] |
Cleans up the segment with given name. You should call this after there is no longer any need for AttachToSegment to succeed.
Implements net_instaweb::AbstractSharedMem.
virtual size_t net_instaweb::InProcessSharedMem::SharedMutexSize | ( | ) | const [virtual] |
All the methods here implement the AbstractSharedMem API --- see the base class for their docs.
Implements net_instaweb::AbstractSharedMem.