Page Speed Optimization Libraries  1.2.24.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
net_instaweb::AbstractSharedMemSegment Class Reference

#include "abstract_shared_mem.h"

List of all members.

Public Member Functions

virtual ~AbstractSharedMemSegment ()
virtual volatile char * Base ()=0
virtual size_t SharedMutexSize () const =0
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

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.

virtual size_t net_instaweb::AbstractSharedMemSegment::SharedMutexSize ( ) const [pure virtual]

This returns the number of bytes a mutex inside shared memory takes.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines