9 #ifndef CPPCOMMON_THREADS_NAMED_CONDITION_VARIABLE_H
10 #define CPPCOMMON_THREADS_NAMED_CONDITION_VARIABLE_H
42 const std::string&
name()
const;
80 template <
typename TPredicate>
81 void Wait(TPredicate predicate);
111 template <
typename TPredicate>
139 template <
typename TPredicate>
146 Impl& impl() noexcept {
return reinterpret_cast<Impl&
>(_storage); }
147 const Impl& impl() const noexcept {
return reinterpret_cast<Impl const&
>(_storage); }
149 static const size_t StorageSize = 168;
150 static const size_t StorageAlign = 8;
151 alignas(StorageAlign) std::byte _storage[StorageSize];
Named condition variable synchronization primitive.
bool TryWaitUntil(const UtcTimestamp ×tamp, TPredicate predicate)
Try to wait until the given timestamp until condition variable is notified using the given predicate.
void NotifyOne()
Notify one of waiting thread about event occurred.
NamedConditionVariable(const NamedConditionVariable &)=delete
~NamedConditionVariable()
bool TryWaitUntil(const UtcTimestamp ×tamp)
Try to wait until the given timestamp until condition variable is notified.
void NotifyAll()
Notify all waiting threads about event occurred.
NamedConditionVariable(const std::string &name)
Default class constructor.
const std::string & name() const
Get the condition variable name.
void Wait()
Wait until condition variable is notified.
bool TryWaitFor(const Timespan ×pan)
Try to wait for the given timespan until condition variable is notified.
NamedConditionVariable & operator=(const NamedConditionVariable &)=delete
NamedConditionVariable(NamedConditionVariable &&cv)=delete
NamedConditionVariable & operator=(NamedConditionVariable &&cv)=delete
Named condition variable synchronization primitive inline implementation.
C++ Common project definitions.