Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
net_instaweb::AbstractSharedMem Class Referenceabstract

#include "abstract_shared_mem.h"

Inheritance diagram for net_instaweb::AbstractSharedMem:
net_instaweb::InProcessSharedMem net_instaweb::NullSharedMem net_instaweb::PthreadSharedMem

Public Member Functions

virtual size_t SharedMutexSize () const =0
 Size of mutexes inside shared memory segments.
 
virtual AbstractSharedMemSegmentCreateSegment (const GoogleString &name, size_t size, MessageHandler *handler)=0
 
virtual AbstractSharedMemSegmentAttachToSegment (const GoogleString &name, size_t size, MessageHandler *handler)=0
 
virtual void DestroySegment (const GoogleString &name, MessageHandler *handler)=0
 
virtual bool IsDummy ()
 

Detailed Description

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

Member Function Documentation

virtual AbstractSharedMemSegment* net_instaweb::AbstractSharedMem::AttachToSegment ( const GoogleString name,
size_t  size,
MessageHandler handler 
)
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.

virtual AbstractSharedMemSegment* net_instaweb::AbstractSharedMem::CreateSegment ( const GoogleString name,
size_t  size,
MessageHandler handler 
)
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.

virtual void net_instaweb::AbstractSharedMem::DestroySegment ( const GoogleString name,
MessageHandler handler 
)
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.

virtual bool net_instaweb::AbstractSharedMem::IsDummy ( )
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.


The documentation for this class was generated from the following file: