If you have some time to dedicate to refactoring your application, I would advise you to take a look at the actor model (see e.g. Theron, Casablanca, libcppa, CAF for C++ implementations).
Actors are objects that run concurrently and communicate with each other only using asynchronous message exchange. So, all the problems of thread management, mutexes, deadlocks, etc, are dealt with by an actor implementation library and you can concentrate on implementing the behaviour of your objects (actors), which boils down to repeating the loop
- Receive message
- Perform computation
- Send message(s) / create / kill other actors.
One approach for you could be to do some reading on the topic first, and possibly have a look at one library or two to see if the actor model can be integrated in your code.
I have been using (a simplified version of) this model in a project of mine for a few months now and I am amazed by how robust it is.