GNU CommonC++
|
This class is used to create a "named" lock entity that can be used to control access to a resource between multiple processes. More...
#include <process.h>
Public Member Functions | |
Lockfile (const char *name) | |
Create a lock under a known name. More... | |
Lockfile () | |
Create a new lock object that can be used to make locks. More... | |
~Lockfile () | |
Destroy the current lock and release it. More... | |
bool | lock (const char *name) |
Lock a system-wide name for this process. More... | |
void | unlock (void) |
Release an acquired lock. More... | |
bool | isLocked (void) |
Flag if the current process has aqcuired a lock. More... | |
This class is used to create a "named" lock entity that can be used to control access to a resource between multiple processes.
The posix implimentation uses a pidfile and the win32 version uses a globally visible mutex.
System-wide named lock
ost::Lockfile::Lockfile | ( | const char * | name | ) |
Create a lock under a known name.
name | of system-wide lock to create. |
ost::Lockfile::Lockfile | ( | ) |
Create a new lock object that can be used to make locks.
|
inline |
Destroy the current lock and release it.
bool ost::Lockfile::isLocked | ( | void | ) |
Flag if the current process has aqcuired a lock.
bool ost::Lockfile::lock | ( | const char * | name | ) |
Lock a system-wide name for this process.
If the lock is successful, return true. If an existing lock was already acquired, release it first.
name | system-wide lock to use. |
void ost::Lockfile::unlock | ( | void | ) |
Release an acquired lock.