I am writing an extension for an existing system in Rust. This system requires I do all communication with the original system in a single thread (the thread from which I was originally called).
I now want to make my code multi-threaded. I need to (occasionally) make calls back to the host program from other threads. Therefore I think I want that original thread to enter a loop where other threads can make requests for it to call into the child process until a result has been produced, then it returns (does that make sense?)
Is there any standard / nice way of doing this? I imagine other systems have similar issues (I believe Python, and Julia, both have requirements that you should only call back from the thread you were called from?)