#include <rendezvous.h>
Inheritance diagram for rendezvous:


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 istring & | root_name () const |
| returns the root name passed in the constructor. | |
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.
| 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] |
| 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] |
| void rendezvous::repeal_lock | ( | ) | [virtual] |
| const istring& rendezvous::root_name | ( | ) | const |
1.5.1