YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
recursive_timed_mutex.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace yaclib::detail::fiber {
7
9 using Base = RecursiveMutex;
10
11 public:
12 using Base::Base;
13
14 template <typename Rep, typename Period>
15 bool try_lock_for(const std::chrono::duration<Rep, Period>& timeout_duration) {
16 return TimedWaitHelper(timeout_duration);
17 }
18
19 template <typename Clock, typename Duration>
20 bool try_lock_until(const std::chrono::time_point<Clock, Duration>& timeout_time) {
21 return TimedWaitHelper(timeout_time);
22 }
23
24 private:
25 template <typename Timeout>
26 bool TimedWaitHelper(const Timeout& timeout) {
27 bool r = true;
30 }
32 "about to be locked twice and not in a good way");
33 if (r) {
34 LockHelper();
35 }
36 return r;
37 }
38};
39
40} // namespace yaclib::detail::fiber
WaitStatus Wait(NoTimeoutTag)
Definition queue.cpp:5
bool try_lock_until(const std::chrono::time_point< Clock, Duration > &timeout_time)
bool try_lock_for(const std::chrono::duration< Rep, Period > &timeout_duration)
static detail::fiber::FiberBase::Id GetId()
Definition scheduler.cpp:52
#define YACLIB_DEBUG(cond, message)
Definition log.hpp:84
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25