Tor isn't multithreaded like that. Its main thread uses an asynchonous
event loop.
I'd make a command queue structure that any thread could use to
asynchronously send commands to the main thread, so that the only
change you'd need to make in the main thread would be enough locking
to handle queued commands and to queue replies. That way the codebase
changes would be much simpler.
In fact, that's how the controller interface works.