4#include <condition_variable>
21 : SystemErrorException{ec, message}
30 template <
typename EXCEPTION>
34 if (Time::GetTickCount () >= afterTickCount) [[unlikely]] {
35 Throw (forward<EXCEPTION> (exception2Throw));
37 Thread::CheckForInterruption ();
41 ThrowTimeoutExceptionAfter (afterTickCount, TimeOutException::kThe);
49 template <
typename TIMED_MUTEX,
typename EXCEPTION>
52 if (not m.try_lock_until (Time::Pin2SafeSeconds (afterTickCount))) {
53 Throw (forward<EXCEPTION> (exception2Throw));
56 template <
typename TIMED_MUTEX>
59 TryLockUntil (m, afterTickCount, TimeOutException::kThe);
67 template <
typename EXCEPTION>
68 inline void ThrowIfTimeout (cv_status conditionVariableStatus, EXCEPTION& exception2Throw)
70 if (conditionVariableStatus == cv_status::timeout) {
71 Throw (forward<EXCEPTION> (exception2Throw));
84 template <
typename TIMED_MUTEX,
typename EXCEPTION>
85 inline unique_lock<TIMED_MUTEX>
UniqueLock (TIMED_MUTEX& m,
const chrono::duration<double>& d, EXCEPTION&& exception2Throw)
87 unique_lock<TIMED_MUTEX> lock{m, d};
88 if (not lock.owns_lock ()) {
89 Throw (forward<EXCEPTION> (exception2Throw));
93 template <
typename TIMED_MUTEX>
94 inline unique_lock<TIMED_MUTEX> UniqueLock (TIMED_MUTEX& m,
const chrono::duration<double>& d)
96 return UniqueLock (m, d, TimeOutException::kThe);
time_point< RealtimeClock, DurationSeconds > TimePointSeconds
TimePointSeconds is a simpler approach to chrono::time_point, which doesn't require using templates e...
void CheckForInterruption()
unique_lock< TIMED_MUTEX > UniqueLock(TIMED_MUTEX &m, const chrono::duration< double > &d, EXCEPTION &&exception2Throw)
void ThrowTimeoutExceptionAfter(Time::TimePointSeconds afterTickCount, EXCEPTION &&exception2Throw)
Throw TimeOutException if the @Time::GetTickCount () is >= the given value.
void ThrowIfTimeout(cv_status conditionVariableStatus, EXCEPTION &&exception2Throw)
void Throw(T &&e2Throw)
identical to builtin C++ 'throw' except that it does helpful, type dependent DbgTrace() messages firs...
void TryLockUntil(TIMED_MUTEX &m, Time::TimePointSeconds afterTickCount, EXCEPTION &&exception2Throw)