feisty meow concerns codebase  2.140
processes::rendezvous Class Reference

An inter-process synchronization primitive. More...

#include <rendezvous.h>

Inheritance diagram for processes::rendezvous:
Collaboration diagram for processes::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 basis::astring &root_name)
 the healthy() method should be checked to ensure creation succeeded. More...
 
virtual ~rendezvous ()
 any lock held is released and the lower level structures freed. More...
 
 DEFINE_CLASS_NAME ("rendezvous")
 
bool healthy () const
 returns true if the rendezvous object is operable. More...
 
bool lock (locking_methods how=ENDLESS_WAIT)
 grab the lock, if possible. More...
 
void unlock ()
 releases a previously acquired lock. More...
 
virtual void establish_lock ()
 
virtual void repeal_lock ()
 
const basis::astringroot_name () const
 returns the root name passed in the constructor. More...
 

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

◆ 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()

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

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

Definition at line 70 of file rendezvous.cpp.

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

◆ ~rendezvous()

processes::rendezvous::~rendezvous ( )
virtual

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

Definition at line 98 of file rendezvous.cpp.

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

Member Function Documentation

◆ DEFINE_CLASS_NAME()

processes::rendezvous::DEFINE_CLASS_NAME ( "rendezvous"  )

◆ establish_lock()

void processes::rendezvous::establish_lock ( )
virtual

Implements basis::base_synchronizer.

Definition at line 132 of file rendezvous.cpp.

References lock().

◆ healthy()

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 136 of file rendezvous.cpp.

Referenced by lock(), and unlock().

◆ lock()

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 141 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().

◆ repeal_lock()

void processes::rendezvous::repeal_lock ( )
virtual

Implements basis::base_synchronizer.

Definition at line 134 of file rendezvous.cpp.

References unlock().

◆ root_name()

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

returns the root name passed in the constructor.

Referenced by rendezvous().

◆ unlock()

void processes::rendezvous::unlock ( )

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