3#include <yaclib/config.hpp>
19 return _mutex.TryLockAwait();
22 template <
typename Promise>
23 YACLIB_INLINE
bool await_suspend(yaclib_std::coroutine_handle<Promise> handle)
noexcept {
24 auto& promise = handle.promise();
25 _executor = promise._executor.Get();
26 if (_mutex.AwaitLock(promise)) {
48 if (_executor !=
nullptr) {
55 template <
typename Promise>
56 YACLIB_INLINE
auto await_suspend(yaclib_std::coroutine_handle<Promise> handle)
noexcept {
58 return _mutex.AwaitUnlockOn(handle.promise(), *_executor);
70class GuardStickyAwaiter;
91 auto*
m =
static_cast<M*
>(Base::LockState());
97 auto*
m =
static_cast<M*
>(Base::UnlockState());
104 std::swap(_executor,
other._executor);
123 auto& mutex_impl = M::template Cast<typename M::Base>(*_guard.Mutex());
125 return awaiter.await_ready();
128 template <
typename Promise>
129 YACLIB_INLINE
bool await_suspend(yaclib_std::coroutine_handle<Promise> handle)
noexcept {
130 auto& mutex_impl = M::template Cast<typename M::Base>(*_guard.Mutex());
132 return awaiter.await_suspend(handle);
137 return std::move(_guard);
StickyGuard(StickyGuard &&other) noexcept
StickyGuard & operator=(StickyGuard &&other) noexcept
void Swap(StickyGuard &other) noexcept
YACLIB_INLINE bool await_suspend(yaclib_std::coroutine_handle< Promise > handle) noexcept
YACLIB_INLINE auto await_resume() noexcept
YACLIB_INLINE bool await_ready() noexcept
YACLIB_INLINE bool await_ready() noexcept
YACLIB_INLINE bool await_suspend(yaclib_std::coroutine_handle< Promise > handle) noexcept
constexpr void await_resume() noexcept
LockStickyAwaiter(M &m, IExecutor *&e) noexcept
YACLIB_INLINE bool await_ready() noexcept
constexpr void await_resume() noexcept
YACLIB_INLINE auto await_suspend(yaclib_std::coroutine_handle< Promise > handle) noexcept
UnlockStickyAwaiter(M &m, IExecutor *e) noexcept
#define YACLIB_ASSERT(cond)
Contract< V, E > MakeContract()
Creates related future and promise.