71 #include <condition_variable> 85 , std::condition_variable_any
90 wait (PRED&& predicate)
92 condVar().wait (mutex(), std::forward<PRED> (predicate));
98 template<
class REPR,
class PERI,
class PRED>
100 wait_for (std::chrono::duration<REPR, PERI>
const& timeout, PRED&& predicate)
102 return condVar().wait_for (mutex(), timeout, std::forward<PRED> (predicate));
108 return static_cast<MTX&
> (*this);
110 std::condition_variable_any&
113 return static_cast<std::condition_variable_any&
> (*this);
120 void unlock() noexcept { }
139 void lock() { IMPL::lock(); }
140 void unlock() noexcept { IMPL::unlock(); }
142 void notify_one() noexcept { IMPL::notify_one(); }
143 void notify_all() noexcept { IMPL::notify_all(); }
147 wait (PRED&& predicate)
149 IMPL::wait (std::forward<PRED>(predicate));
152 template<
class DUR,
class PRED>
154 wait_for (DUR
const& timeout, PRED&& predicate)
156 return IMPL::wait_for (timeout, std::forward<PRED> (predicate));
160 using NonrecursiveLock_NoWait = std::mutex;
161 using RecursiveLock_NoWait = std::recursive_mutex;
179 using sync::NonrecursiveLock_NoWait;
181 using sync::RecursiveLock_NoWait;
208 template<
class CONF = NonrecursiveLock_NoWait>
212 mutable Monitor objectMonitor_;
216 getMonitor(
Sync const* forThis)
219 return forThis->objectMonitor_;
233 Lock(X* it) : mon_{getMonitor(it)}{ mon_.lock(); }
234 ~
Lock() { mon_.unlock(); }
236 void notify_one() { mon_.notify_one(); }
237 void notify_all() { mon_.notify_all(); }
241 wait (PRED&& predicate)
243 mon_.wait (std::forward<PRED>(predicate));
246 template<
class DUR,
class PRED>
248 wait_for (DUR
const& timeout, PRED&& predicate)
250 return mon_.wait_for (timeout, std::forward<PRED> (predicate));
256 template<
class X,
class PRED>
258 : mon_(getMonitor(it))
262 mon_.wait (std::forward<PRED>(predicate));
Facility for monitor object based locking.
Lock(Monitor &m)
for creating a ClassLock
Any copy and copy construction prohibited.
scoped guard to control the actual locking.
Implementation namespace for support and library code.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
bool wait_for(std::chrono::duration< REPR, PERI > const &timeout, PRED &&predicate)
Lock(X *it, PRED &&predicate)
convenience shortcut: Locks and immediately enters wait state on the given predicate ...
Lumiera error handling (C++ interface).
Monitor & accessMonitor()
subclass access to underlying sync primitives
Object Monitor for synchronisation and waiting.