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.