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

#include "inprocess_shared_mem.h"

Inheritance diagram for net_instaweb::InProcessSharedMem:
net_instaweb::AbstractSharedMem

List of all members.

Public Member Functions

 InProcessSharedMem (ThreadSystem *thread_system)
 Does not take ownership of thread_system.
virtual size_t SharedMutexSize () const
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

This class emulates the normally cross-process shared memory API within a single process on top of threading APIs, in order to permit deploying classes built for shared memory into single-process servers or tests. Note, however, that a direct implementation taking advantage of much simpler in-process programming model may be far superior.


Member Function Documentation

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

virtual size_t net_instaweb::InProcessSharedMem::SharedMutexSize ( ) const [virtual]

All the methods here implement the AbstractSharedMem API --- see the base class for their docs.

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