9 #ifndef CPPCOMMON_THREADS_CONDITION_VARIABLE_H
10 #define CPPCOMMON_THREADS_CONDITION_VARIABLE_H
83 template <
typename TPredicate>
117 template <
typename TPredicate>
147 template <
typename TPredicate>
154 Impl& impl() noexcept {
return reinterpret_cast<Impl&
>(_storage); }
155 const Impl& impl() const noexcept {
return reinterpret_cast<Impl const&
>(_storage); }
157 static const size_t StorageSize = 48;
158 static const size_t StorageAlign = 8;
159 alignas(StorageAlign) std::byte _storage[StorageSize];
Condition variable synchronization primitive.
ConditionVariable(ConditionVariable &&cv)=delete
ConditionVariable & operator=(const ConditionVariable &)=delete
ConditionVariable & operator=(ConditionVariable &&cv)=delete
bool TryWaitUntil(CriticalSection &cs, const UtcTimestamp ×tamp)
Try to wait until the given timestamp until condition variable is notified.
bool TryWaitFor(CriticalSection &cs, const Timespan ×pan)
Try to wait for the given timespan until condition variable is notified.
void Wait(CriticalSection &cs)
Wait until condition variable is notified.
void NotifyOne()
Notify one of waiting thread about event occurred.
void NotifyAll()
Notify all waiting threads about event occurred.
bool TryWaitUntil(CriticalSection &cs, const UtcTimestamp ×tamp, TPredicate predicate)
Try to wait until the given timestamp until condition variable is notified using the given predicate.
ConditionVariable(const ConditionVariable &)=delete
Critical section synchronization primitive.
Condition variable synchronization primitive inline implementation.
Critical section synchronization primitive definition.
C++ Common project definitions.