net_instaweb::PthreadSharedMem Class Reference

#include "pthread_shared_mem.h"

Inheritance diagram for net_instaweb::PthreadSharedMem:
net_instaweb::AbstractSharedMem

List of all members.

Public Member Functions

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

Detailed Description

POSIX shared memory support, using mmap/pthread_mutexattr_setpshared Supports both processes and threads, but processes that want to access it must be results of just fork (without exec), and all the CreateSegment calls must occur before the fork.

This implementation is also not capable of deallocating segments except at exit, so it should not be used when the set of segments may be dynamic.


Member Function Documentation

virtual AbstractSharedMemSegment* net_instaweb::PthreadSharedMem::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::PthreadSharedMem::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::PthreadSharedMem::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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:14 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3