processes::rendezvous Class Reference

An inter-process synchronization primitive. More...

#include <rendezvous.h>

Inheritance diagram for processes::rendezvous:
Inheritance graph
[legend]
Collaboration diagram for processes::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 basis::astring &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.
 DEFINE_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 basis::astringroot_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 33 of file rendezvous.h.


Member Enumeration Documentation

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

processes::rendezvous::rendezvous ( const basis::astring root_name  ) 

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

Definition at line 73 of file rendezvous.cpp.

References FUNCDEF, processes::general_lock_name(), LOG, NIL, basis::astring::s(), and processes::unix_rendez_file().

processes::rendezvous::~rendezvous (  )  [virtual]

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

Definition at line 101 of file rendezvous.cpp.

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


Member Function Documentation

processes::rendezvous::DEFINE_CLASS_NAME ( "rendezvous"   ) 
void processes::rendezvous::establish_lock (  )  [virtual]

Implements basis::base_synchronizer.

Definition at line 135 of file rendezvous.cpp.

References lock().

bool processes::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 139 of file rendezvous.cpp.

Referenced by lock(), and unlock().

bool processes::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 144 of file rendezvous.cpp.

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

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

void processes::rendezvous::repeal_lock (  )  [virtual]

Implements basis::base_synchronizer.

Definition at line 137 of file rendezvous.cpp.

References unlock().

const basis::astring& processes::rendezvous::root_name (  )  const

returns the root name passed in the constructor.

void processes::rendezvous::unlock (  ) 

releases a previously acquired lock.

Definition at line 184 of file rendezvous.cpp.

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

Referenced by application::singleton_application::release_lock(), repeal_lock(), and application::shared_memory::shared_memory().


The documentation for this class was generated from the following files:
Generated on Sat Jan 28 04:25:52 2012 for hoople2 project by  doxygen 1.6.3