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

#include "shared_circular_buffer.h"

List of all members.

Public Member Functions

 SharedCircularBuffer (AbstractSharedMem *shm_runtime, const int buffer_capacity, const GoogleString &filename_prefix, const GoogleString &filename_suffix)
bool InitSegment (bool parent, MessageHandler *handler)
void Clear ()
 Reset circular buffer.
bool Write (const StringPiece &message)
 Write content to circular buffer.
bool Dump (Writer *writer, MessageHandler *handler)
 Write content of data in buffer to writer, without clearing the buffer.
GoogleString ToString (MessageHandler *handler)
 Return data content as string. This is for test purposes.
void GlobalCleanup (MessageHandler *handler)

Detailed Description

Shared memory circular buffer, the content of its shared memory segment is a Mutex and a CircularBuffer. In parent process, we initialize a shared memory segment. Then we create a SharedCircularBuffer object in each process and attach it to the segment by calling InitSegment(true, handler) once in the parent process and calling InitSegment(false, handler) in each child.


Constructor & Destructor Documentation

net_instaweb::SharedCircularBuffer::SharedCircularBuffer ( AbstractSharedMem shm_runtime,
const int  buffer_capacity,
const GoogleString filename_prefix,
const GoogleString filename_suffix 
)

Construct with shared memory, data buffer capacity, filename_prefix and filename_suffix. filename_prefix and filename_suffix are used to name segment for the shared circular buffer.


Member Function Documentation

This should be called from the root process as it is about to exit, when no future children are expected to start.

bool net_instaweb::SharedCircularBuffer::InitSegment ( bool  parent,
MessageHandler handler 
)

Initialize the shared memory segment. parent = true if this is invoked in root process -- initialize the shared memory; parent = false if this is invoked in child process -- attach to existing segment.


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