EricWF wrote: On second thought, this is actually inadequate . Since the `in_async` variable can go out of scope between being set to true and having `notify_all` set on it. So the condition variable approach is probably best. https://github.com/llvm/llvm-project/pull/146240