Mutex {
awaiter Lock();
Guard<awaiter> -> unique_lock<awaiter> Gaurd();
}
auto guard = co_await mtx.Guard(); -> mtx.Unlock();
void = co_await mtx.Lock();
void = co_await mtx/guard.Unlock(IExecutor& e = CurrentThreadPool());
bool try_lock();
co_await mtx.Lock();
...
co_await mtx.Unlock(GlobalThreadPool());
co_await mtx.Lock();
...
mtx.Unlock();
auto guard = co_await mtx.Guard(); // guard could be cast to std::unique_lock<...>
...
guard.Unlock(); // co_await mtx.Unlock(GlobalThreadPool());
co_await m.Lock();
...
m.Unlock();
co_await Via(tp);
{
...
auto lock = /*handle.resume()/await_suspend(return false)*/ co_await mtx.Lock();
...cs...
throw ...
...cs...
co_await lock.unlock(tp); <- submit all other hadnles to tp
lock.unlock();
...
} // 0 reschedule, 2 reschedule
{
...
co_await Via(strand); // PromiseType::Call() -> handle.resume()
throw ... // <- set_unhandled_exception(...) -> return from resume
...cs...
co_await Via(tp);
...
} // 2 reschedule
{
...
auto lock = /*handle.resume()/await_suspend(return false)*/ co_await mtx.Lock();
...cs...
co_await lock.unlock();
suspend
...tp...
} // 0 reschedule, 2 reschedule
{
...
co_await Via(strand); // PromiseType::Call() -> handle.resume()
...cs...
co_await Via(tp);
...
} // 2 reschedule
Last active
April 17, 2022 13:06
-
-
Save MBkkt/8cdc71a3259c67a3b3b223b8cafb6135 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment