Page Speed Optimization Libraries
1.13.35.1
|
#include "abstract_shared_mem.h"
Public Member Functions | |
virtual size_t | SharedMutexSize () const =0 |
Size of mutexes inside shared memory segments. | |
virtual AbstractSharedMemSegment * | CreateSegment (const GoogleString &name, size_t size, MessageHandler *handler)=0 |
virtual AbstractSharedMemSegment * | AttachToSegment (const GoogleString &name, size_t size, MessageHandler *handler)=0 |
virtual void | DestroySegment (const GoogleString &name, MessageHandler *handler)=0 |
virtual bool | IsDummy () |
Interface for creating and attaching to named shared memory segments. The expectation is that whichever implementation is used at runtime will be able to handle the combination of threads & processes used by the hosting environment.
The basic flow here is as follows:
Single process/thread startup stage: CreateSegment InitializeSharedMutex -----+ / | / |
process/thread: process/thread: AttachToSegment AttachToSegment AttachToSharedMutex AttachToSharedMutex | | | | |---------------------------------—/ | single process/thread cleanup stage: DestroySegment
|
pure virtual |
Attaches to an existing segment, which must have been created already. May return NULL on failure
Implemented in net_instaweb::InProcessSharedMem, net_instaweb::PthreadSharedMem, and net_instaweb::NullSharedMem.
|
pure 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.
Implemented in net_instaweb::InProcessSharedMem, net_instaweb::PthreadSharedMem, and net_instaweb::NullSharedMem.
|
pure virtual |
Cleans up the segment with given name. You should call this after there is no longer any need for AttachToSegment to succeed.
Implemented in net_instaweb::InProcessSharedMem, net_instaweb::PthreadSharedMem, and net_instaweb::NullSharedMem.
|
inlinevirtual |
Implementors such as NullSharedMem that don't actually support shared memory operations should return true. All real implementations should leave this as false.
Reimplemented in net_instaweb::NullSharedMem.