3#include <yaclib/config.hpp>
10template <
typename M,
bool Shared = false>
17 if constexpr (Shared) {
18 return _mutex.TryLockSharedAwait();
20 return _mutex.TryLockAwait();
24 template <
typename Promise>
25 YACLIB_INLINE
bool await_suspend(yaclib_std::coroutine_handle<Promise> handle)
noexcept {
26 if constexpr (Shared) {
27 return _mutex.AwaitLockShared(handle.promise());
29 return _mutex.AwaitLock(handle.promise());
40template <
template <
typename>
typename Guard,
typename M,
bool Shared =
false>
43 using LockAwaiter<
typename M::Base, Shared>::LockAwaiter;
46 return Guard<M>{M::template Cast<M>(this->_mutex), std::adopt_lock};
YACLIB_INLINE auto await_resume() noexcept
constexpr void await_resume() noexcept
YACLIB_INLINE bool await_suspend(yaclib_std::coroutine_handle< Promise > handle) noexcept
YACLIB_INLINE bool await_ready() noexcept
LockAwaiter(M &m) noexcept
Contract< V, E > MakeContract()
Creates related future and promise.