3 #ifndef INCLUDE_NN_NLIB_THREADING_CONDVARFALLBACK_H_
4 #define INCLUDE_NN_NLIB_THREADING_CONDVARFALLBACK_H_
17 void Notify() NLIB_NOEXCEPT { this->signal_(
false); }
19 template <
class lock_type>
21 return this->wait_(lock, NULL);
23 template <
class lock_type>
24 errno_t WaitFor(lock_type& lock,
26 return this->wait_(lock, &timeout);
28 template <
class lock_type>
29 errno_t WaitUntil(lock_type& lock,
32 errno_t e = DateTime::GetNow(&now);
34 return this->WaitFor(lock, datetime - now);
38 template <
class lock_type>
40 explicit ScopedUnlock(lock_type& lock) : m_Lock(lock) {
43 ~ScopedUnlock() { m_Lock.lock(); }
50 template <
class lock_type>
57 UniquePtr<Data_> m_Obj;
60 template <
class lock_type>
61 inline errno_t CondVarFallback::wait_(lock_type& lock,
64 if (!m_Obj)
return EINVAL;
67 ScopedUnlock<lock_type> ulk(lock);
68 return this->wait_2(timeout);
71 #ifdef NLIB_CONDVAR_USE_FALLBACK
72 typedef CondVarFallback CondVar;
78 #endif // INCLUDE_NN_NLIB_THREADING_CONDVARFALLBACK_H_
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
Defines that class that is corresponding to std::unique_ptr.
The class for representing the date and time.
Defines the class for handling times and durations.
The class for representing the time.