Bayonne2 / Common C++ 2 Framework
Public Member Functions | Private Attributes
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>

Collaboration diagram for Lockfile:
Collaboration graph
[legend]

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...
 

Private Attributes

char *  _path
 

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.nosp@m.@ost.nosp@m.el.co.nosp@m.m System-wide named lock

Definition at line 259 of file process.h.

Constructor & Destructor Documentation

Lockfile::Lockfile ( const char *  name )

Create a lock under a known name.

Parameters
name of system-wide lock to create.
Lockfile::Lockfile ( )

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

Lockfile::~Lockfile ( )
inline

Destroy the current lock and release it.

Definition at line 285 of file process.h.

Member Function Documentation

bool Lockfile::isLocked ( void  )

Flag if the current process has aqcuired a lock.

Returns
true if we have the lock.
bool 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 Lockfile::unlock ( void  )

Release an acquired lock.

Field Documentation

char* Lockfile::_path
private

Definition at line 266 of file process.h.


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

Generated on Dec 21, 2017 for commoncpp2-1.8.1, ccrtp-1.7.2, libzrtpcpp-2.3.4, ccscript3-1.1.7, ccaudio2-1.0.0 and bayonne2-2.3.2 (after installation in /usr/local/) by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /