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&nbsp; 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 &quot;thread-safe&quot; 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 :&nbsp; <br>If I just &quot;defer&quot; that function &quot;toThread&quot; ( like&nbsp; threads.deferToThread( myServerProcessingFunction ) ). Do I have potential problems, when several threads try to distribute its result to the connecting clients???&nbsp; <br>
<br><br>If I have a problem:<br>Can I make a quick fix as follows:&nbsp; Within each thread ( started with the threads.deferToThread function ), I do the distributing to the clients by using the &quot;reactor.callFromThread&quot; <br>
( like reactor.callFromThread( distributeToAllClient , myResult ) where the function distributeToAllClient are using the remoteReference for each client to send the &quot;myResult&quot; )<br><br><br>Or is the only solution, to let the myServerProcessingFunction returns the &quot;myResult&quot; 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>