Comment by gpderetta
3 months ago
CPS can trivially deadlock for all meaningful definitions of deadlock.
Would you consider this a mutex?
async_mutex mux;
co_await mux.lock();
/* critical section */
co_await mux.unlock();
What about: my_mutex mux;
{
std::lock_guard _{mux};
/* critical section */
}
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).
You only achieved a deadlock by re-introducing mutexes.
Given:
1:
2:
3:
4:
If 1 is a mutex, at which point it stops being a mutex? Note that 4 is my initial example.
it's a mutex iff it's acquiring a resource exclusively.
which you don't need to do for synchronization of coroutines since you can control in which order things are scheduled and whether that's done concurrently or not.
2 replies →