rendezvous Class Reference

An inter-process synchronization primitive. More...

#include <rendezvous.h>

Inheritance diagram for rendezvous:

Inheritance graph
[legend]
Collaboration diagram for rendezvous:

Collaboration graph
[legend]
List of all members.

Public Types

enum  locking_methods { NO_LOCKING, ENDLESS_WAIT, IMMEDIATE_RETURN }
 different ways that the lock() attempt can be made. More...

Public Member Functions

 rendezvous (const istring &root_name)
 the healthy() method should be checked to ensure creation succeeded.
virtual ~rendezvous ()
 any lock held is released and the lower level structures freed.
 IMPLEMENT_CLASS_NAME ("rendezvous")
bool healthy () const
 returns true if the rendezvous object is operable.
bool lock (locking_methods how=ENDLESS_WAIT)
 grab the lock, if possible.
void unlock ()
 releases a previously acquired lock.
virtual void establish_lock ()
virtual void repeal_lock ()
const istringroot_name () const
 returns the root name passed in the constructor.

Detailed Description

An inter-process synchronization primitive.

A lock can be created that only one process owns at a time; those that do not acquire the lock can either return immediately or wait until the current lock owner releases the rendezvous. This is unlike the mutex object in basis, since mutexes only synchronize within the same application. The rendezvous can instead allow synchronization of resources between applications, but this comes at a higher cost per usage.

Definition at line 32 of file rendezvous.h.


Member Enumeration Documentation

enum rendezvous::locking_methods

different ways that the lock() attempt can be made.

Enumerator:
NO_LOCKING 
ENDLESS_WAIT 
IMMEDIATE_RETURN 

Definition at line 50 of file rendezvous.h.


Constructor & Destructor Documentation

rendezvous::rendezvous ( const istring root_name  ) 

the healthy() method should be checked to ensure creation succeeded.

Definition at line 71 of file rendezvous.cpp.

References FUNCDEF, general_lock_name(), LOG, NIL, root_name(), istring::s(), portable::system_error(), portable::system_error_text(), and unix_rendez_file().

rendezvous::~rendezvous (  )  [virtual]

any lock held is released and the lower level structures freed.

Definition at line 97 of file rendezvous.cpp.

References fileno, FUNCDEF, LOG, NIL, and WHACK().


Member Function Documentation

rendezvous::IMPLEMENT_CLASS_NAME ( "rendezvous"   ) 

bool rendezvous::healthy (  )  const

returns true if the rendezvous object is operable.

there are cases where creation of the rendezvous might fail; they can be trapped here.

Definition at line 135 of file rendezvous.cpp.

Referenced by lock(), file_logger::truncate(), and unlock().

bool rendezvous::lock ( locking_methods  how = ENDLESS_WAIT  ) 

grab the lock, if possible.

if this is not the first time locking the same rendezvous, that's fine as long as the number of unlocks matches the number of locks.

Definition at line 140 of file rendezvous.cpp.

References ENDLESS_WAIT, fileno, FUNCDEF, healthy(), LOG, and NO_LOCKING.

Referenced by singleton_application::allow_this_instance(), establish_lock(), shared_memory::lock(), shared_memory::shared_memory(), and file_logger::truncate().

void rendezvous::unlock (  ) 

releases a previously acquired lock.

Definition at line 178 of file rendezvous.cpp.

References fileno, FUNCDEF, healthy(), and LOG.

Referenced by repeal_lock(), shared_memory::shared_memory(), file_logger::truncate(), shared_memory::unlock(), service_root::~service_root(), and singleton_application::~singleton_application().

void rendezvous::establish_lock (  )  [virtual]

Implements synchronizer_base.

Definition at line 131 of file rendezvous.cpp.

References lock().

void rendezvous::repeal_lock (  )  [virtual]

Implements synchronizer_base.

Definition at line 133 of file rendezvous.cpp.

References unlock().

const istring& rendezvous::root_name (  )  const

returns the root name passed in the constructor.

Referenced by rendezvous().


The documentation for this class was generated from the following files:
Generated on Fri Sep 5 04:30:46 2008 for HOOPLE Libraries by  doxygen 1.5.1