On the perils of holding a lock across a coroutine suspension point, part 2: Nonrecursive mutexes

3 · Raymond Chen · July 8, 2021, 2:03 p.m.
Last time, we looked at what can go wrong if you hold a recursive mutex across a coroutine suspension point. Do things get any better if you switch to a nonrecursive mutex? Recall that we are looking at this function: IAsyncAction MyObject::RunOneAsync() { std::lock_guard guard(m_mutex); The post On the perils of holding a lock across a coroutine suspension point, part 2: Nonrecursive mutexes appeared first on The Old New Thing....