A simple pattern I follow for C++ concurrency is to have each thread run an event loop and use https://github.com/cameron314/concurrentqueue as `concurrentqueue<std::function<void()>` for execution of code in the other thread ; I don't remember getting threading problems by doing like this as long as any shared resource either outlives both threads or is in a shared_ptr of sorts.