Hello, I am relative new to twisted, though I have manage to make a simple client server solution ( using perspective broker ) that I am now try to refactor a little.<br><br>The solution is now something like : <br><br>Using perspective broker, clients connects to the server ( setting up a remote reference to each other ).<br>
Via a PB call, each client can request the server do some processing. The result of the processing is distributed to each connected client - and the client asking for the request gets a simple status report!<br><br>This solution works quite well, the only bottleneck is that all the "thread-safe" processing on the server is done in the mainloop of the server reactor. I want to do concurrent processing on the server!<br>
<br>The function doing the processing on the server, also distribute the result to all the connected clients, and returns the result to the klient asking for the request.<br><br>My question is : <br>If I just "defer" that function "toThread" ( like threads.deferToThread( myServerProcessingFunction ) ). Do I have potential problems, when several threads try to distribute its result to the connecting clients??? <br>
<br><br>If I have a problem:<br>Can I make a quick fix as follows: Within each thread ( started with the threads.deferToThread function ), I do the distributing to the clients by using the "reactor.callFromThread" <br>
( like reactor.callFromThread( distributeToAllClient , myResult ) where the function distributeToAllClient are using the remoteReference for each client to send the "myResult" )<br><br><br>Or is the only solution, to let the myServerProcessingFunction returns the "myResult" to be distributed to all connected clients, and do the distribution in the reactor mainthread???<br>
<br><br>Thank you!<br><br><br>Brian<br>