ost::Lockfile Class Reference

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>

List of all members.

Public Member Functions

 Lockfile (const char *name)
 Create a lock under a known name.
 Lockfile ()
 Create a new lock object that can be used to make locks.
 ~Lockfile ()
 Destroy the current lock and release it.
bool lock (const char *name)
 Lock a system-wide name for this process.
void unlock (void)
 Release an acquired lock.
bool isLocked (void)
 Flag if the current process has aqcuired a lock.


Detailed Description

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.

Author:
David Sugar <dyfet@ostel.com> System-wide named lock

Constructor & Destructor Documentation

ost::Lockfile::Lockfile ( const char *  name  ) 

Create a lock under a known name.

Parameters:
name of system-wide lock to create.

ost::Lockfile::Lockfile (  ) 

Create a new lock object that can be used to make locks.

ost::Lockfile::~Lockfile (  )  [inline]

Destroy the current lock and release it.


Member Function Documentation

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.

Returns:
true if lock successful.
Parameters:
name system-wide lock to use.

void ost::Lockfile::unlock ( void   ) 

Release an acquired lock.

bool ost::Lockfile::isLocked ( void   ) 

Flag if the current process has aqcuired a lock.

Returns:
true if we have the lock.


The documentation for this class was generated from the following file:

Generated on Fri Jan 8 01:25:57 2016 for GNU CommonC++ by  doxygen 1.5.6