| 4 | namespace pmon::util::pipe |
| 5 | { |
| 6 | as::awaitable<void> CoroMutex::Lock() |
| 7 | { |
| 8 | if (counter_++ == 0) { |
| 9 | co_return; |
| 10 | } |
| 11 | |
| 12 | auto ec = boost::system::error_code{}; |
| 13 | Timer timer{ ctx_ }; |
| 14 | timer.expires_after(Timer::duration::max()); |
| 15 | waiters_.push_back(&timer); |
| 16 | co_await timer.async_wait(as::redirect_error(as::use_awaitable, ec)); |
| 17 | holdoff_ = false; |
| 18 | } |
| 19 | bool CoroMutex::TryLock() |
| 20 | { |
| 21 | if (counter_ == 0) { |