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::AbstractSharedMemSegment Class Referenceabstract

#include "abstract_shared_mem.h"

Public Member Functions

virtual ~AbstractSharedMemSegment ()
 
virtual volatile char * Base ()=0
 
virtual size_t SharedMutexSize () const =0
 Returns the number of bytes a mutex inside shared memory takes.
 
virtual bool InitializeSharedMutex (size_t offset, MessageHandler *handler)=0
 
virtual AbstractMutexAttachToSharedMutex (size_t offset)=0
 

Detailed Description

This represents a region of memory shared between between multiple processes that may contain mutexes.

Constructor & Destructor Documentation

virtual net_instaweb::AbstractSharedMemSegment::~AbstractSharedMemSegment ( )
virtual

Destroying the segment object detaches from it, making all pointers into it invalid.

Member Function Documentation

virtual volatile char* net_instaweb::AbstractSharedMemSegment::Base ( )
pure virtual

Returns the base address of the segment. Note that there is no guarantee that this address will be the same for other processes attached to the same segment.

virtual bool net_instaweb::AbstractSharedMemSegment::InitializeSharedMutex ( size_t  offset,
MessageHandler handler 
)
pure virtual

To use a mutex in shared memory, you first need to dedicate some [offset, offset + SharedMutexSize()) chunk of memory to it. Then, exactly one process must call InitializeSharedMutex(offset), and all users must call AttachToSharedMutex(offset) afterwards.

InitializeSharedMutex returns whether it succeeded or not. AttachToSharedMutex returns a fresh object, giving ownership to the caller. The object returned is outside shared memory, and acts a helper for referring to the shared state.


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