Lumiera  0.pre.03
»edit your freedom«
ClassLock< X, CONF > Class Template Reference

#include "lib/sync-classlock.hpp"

Description

template<class X, class CONF = RecursiveLock_NoWait>
class lib::ClassLock< X, CONF >

A synchronisation protection guard employing a lock scoped to the parameter type as a whole, not an individual instance.

After creating an instance, every other access specifying the same type is blocked.

Note
the Lock is recursive, because several instances within the same thread may want to acquire it at the same time without deadlock.
there is a design sloppiness, as two instantiations of the ClassLock template with differing CONF count as different type. Actually using two different configurations within for a single class X should be detected and flagged as error, but actually just two non-shared lock instances get created silently. Beware!
See also
Sync::Lock the usual simple instance-bound variant

Definition at line 55 of file sync-classlock.hpp.

Classes

struct  PerClassMonitor
 

Private Types

using Lock = typename Sync< CONF >::Lock
 
using Monitor = typename sync::Monitor< CONF >
 

Private Member Functions

Monitor & getPerClassMonitor ()
 

Additional Inherited Members

- Public Member Functions inherited from Sync< CONF >::Lock
template<class X >
 Lock (X *it)
 
template<class X , class PRED >
 Lock (X *it, PRED &&predicate)
 convenience shortcut: Locks and immediately enters wait state on the given predicate
 
void notify_all ()
 
void notify_one ()
 
template<class PRED >
void wait (PRED &&predicate)
 
template<class DUR , class PRED >
bool wait_for (DUR const &timeout, PRED &&predicate)
 
- Protected Member Functions inherited from Sync< CONF >::Lock
 Lock (Monitor &m)
 for creating a ClassLock
 
MonitoraccessMonitor ()
 subclass access to underlying sync primitives
 
+ Inheritance diagram for ClassLock< X, CONF >:
+ Collaboration diagram for ClassLock< X, CONF >:

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