JSON RPC Server Thread Safety #291
-
I've been playing around with the JSON-RPC server and was wondering about its thread safety properties. Is it safe to share a single server instance between multiple threads that are servicing requests from different clients? It seems like it works fine in a little test application I've been playing with and looking through the code I don't see any obvious issues. I figured I'd ask in case there are subtle details I'm missing. If it safe to use in this way then maybe a quick sentence added the JSON RPC doc page would help answer future people's questions. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
When implemented I had not multithreaded in mind and therefore it does not use any mutex locks. So in case of json rpc method you would need to finish serving one call before other can occur. |
Beta Was this translation helpful? Give feedback.
When implemented I had not multithreaded in mind and therefore it does not use any mutex locks. So in case of json rpc method you would need to finish serving one call before other can occur.
But the state of the json rpc objects are rarely changing so carefully it could be run in multithreaded context. But I am not sure if you could bind a callback function to the object which should run in different thread, which is probably what you would like?