Comment by mgaunard
7 hours ago
that isn't a mutex, that's delegating work asynchronously and delegating something else to run when it is complete (the implicitly defined continuation through coroutines).
In systems programming parlance, a mutex is a resource which can be acquired and released, acquired exactly once, and blocks on acquire if already acquired.
Do a CPS transform of your typical std::mutex critical section and you'll find they are exactly the same.
They're not, the interactions with the memory model are different, as are the guarantees.
CPS shouldn't be able to deadlock for example?
CPS can trivially deadlock for all meaningful definitions of deadlock.
Would you consider this a mutex?
What about: my_mutex mux;
where the code runs in a user space fiber.
Would you consider boost synchronized a mutex?
Don't confuse the semantics with the implementation details (yes async/await leaks implementation details).