Page Speed Optimization Libraries
1.13.35.1
|
namespace SharedMemLockData More...
#include "shared_mem_lock_manager.h"
Public Member Functions | |
SharedMemLockManager (AbstractSharedMem *shm, const GoogleString &path, Scheduler *scheduler, Hasher *hasher, MessageHandler *handler) | |
bool | Initialize () |
bool | Attach () |
virtual SchedulerBasedAbstractLock * | CreateNamedLock (const StringPiece &name) |
Static Public Member Functions | |
static void | GlobalCleanup (AbstractSharedMem *shm, const GoogleString &path, MessageHandler *message_handler) |
Friends | |
class | SharedMemLock |
namespace SharedMemLockData
A simple shared memory named locking manager, which uses scheduler alarms (via SchedulerBasedAbstractLock) when it needs to block.
net_instaweb::SharedMemLockManager::SharedMemLockManager | ( | AbstractSharedMem * | shm, |
const GoogleString & | path, | ||
Scheduler * | scheduler, | ||
Hasher * | hasher, | ||
MessageHandler * | handler | ||
) |
Note that you must call Initialize() in the root process, and Attach in child processes to finish the initialization.
Locks created by this object must not live after it dies.
bool net_instaweb::SharedMemLockManager::Attach | ( | ) |
Connects to already initialized state from a child process. Returns whether successful.
|
static |
This should be called from the root process as it is about to exit, with the same value as were passed to the constructor of any instance on which Initialize() was called, except the message_handler may be different (if for example the original one is no longer available due to the cleanup sequence).
bool net_instaweb::SharedMemLockManager::Initialize | ( | ) |
Sets up our shared state for use of all child processes. Returns whether successful.