Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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
 

Public Member Functions

 ClassLock ()
 
- Public Member Functions inherited from Sync< CONF >::Lock
template<class X >
 Lock (X *it)
 
 ~Lock ()
 
void notify_one ()
 
void notify_all ()
 
template<class PRED >
void wait (PRED &&predicate)
 
template<class DUR , class PRED >
bool wait_for (DUR const &timeout, PRED &&predicate)
 
template<class X , class PRED >
 Lock (X *it, PRED &&predicate)
 convenience shortcut: Locks and immediately enters wait state on the given predicate
 

Private Types

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

Private Member Functions

MonitorgetPerClassMonitor ()
 

Additional Inherited Members

- Protected Member Functions inherited from Sync< CONF >::Lock
 Lock (Monitor &m)
 for creating a ClassLock
 
MonitoraccessMonitor ()
 subclass access to underlying sync primitives
 

Constructor & Destructor Documentation

◆ ClassLock()

template<class X , class CONF = RecursiveLock_NoWait>
ClassLock ( )
inline

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

Member Typedef Documentation

◆ Lock

template<class X , class CONF = RecursiveLock_NoWait>
using Lock = Sync<CONF>::Lock
private

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

◆ Monitor

template<class X , class CONF = RecursiveLock_NoWait>
using Monitor = sync::Monitor<CONF>
private

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

Member Function Documentation

◆ getPerClassMonitor()

template<class X , class CONF = RecursiveLock_NoWait>
Monitor & getPerClassMonitor ( )
inlineprivate

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

+ Inheritance diagram for ClassLock< X, CONF >:
+ Collaboration diagram for ClassLock< X, CONF >:

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