<Unlocking a mutex and then joining a thread atomi...
# community-feeds
r
Unlocking a mutex and then joining a thread atomically in C++ [closed] In the code below there is a deadlock because uninit_thread waits to acquire m while finish_uninit() joins uninit_thread while holding m. finish_uninit() acquires m because calling join() is not thread-safe (other threads may overwrite uninit_thread during the join() call). Is there some way to "unlock m and call join() atomically", similar to how condition_variable.wait() works ? using namespace std; struct IPlugin { virtual ~IPlugin() = default; virtual void start_uninit() {}...