16 #ifndef INCLUDE_NN_NLIB_THREADING_CONDVAR_H_ 17 #define INCLUDE_NN_NLIB_THREADING_CONDVAR_H_ 28 #ifndef NLIB_CONDVAR_USE_FALLBACK 48 #if defined(__cpp_constexpr) && defined(NLIB_CXX11_DEFAULTED_AND_DELETED_FUNCTIONS) 75 template <
class lock_type>
76 errno_t Wait(lock_type& lock) NLIB_NOEXCEPT NLIB_REQUIRES(lock) {
83 template <
class lock_type>
85 NLIB_NOEXCEPT NLIB_REQUIRES(lock) {
86 return nlib_cond_wait_for(&cond_, detail::GetRawMutex(lock), timeout.ToTimeValue().tick);
88 template <
class lock_type>
92 datetime.ToTimeValue().tick);
96 #if defined(__cpp_constexpr) && defined(NLIB_CXX11_DEFAULTED_AND_DELETED_FUNCTIONS) 108 NLIB_REQUIRES(lock) {
115 NLIB_REQUIRES(lock) {
125 #endif // INCLUDE_NN_NLIB_THREADING_CONDVAR_H_ int64_t tick
These can be used for nlib_time and nlib_duration.
TimeValue ToTimeValue() const noexcept
Converts to a TimeValue object.
void NotifyAll() noexcept
Signals all waiting threads.
void Notify() noexcept
Signals to at least one waiting thread.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
Implements mutex, reentrant timeout mutex, and reentrant mutex.
Simplest critical section. Not reentrant.
Conditional variable for synchronization.
The class for representing the date and time.
errno_t WaitFor(lock_type &lock, const nlib_ns::TimeSpan &timeout) noexcept NLIB_REQUIRES(lock)
Waits with a specified timeout.
Defines the class for handling times and durations.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
A file that contains the configuration information for each development environment.
errno_t Wait(lock_type &lock) noexcept NLIB_REQUIRES(lock)
Waits.
TimeValue ToTimeValue() const noexcept
Returns a TimeValue object.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
The class for representing the time.
errno_t WaitUntil(lock_type &lock, const nlib_ns::DateTime &datetime) noexcept NLIB_REQUIRES(lock)
Waits with a timeout specified in date/time.