Synchronize a XML-RPC server with threads

My Python daemon contains:

  1. a XML-RPC server to allow the urp program to call methods defined externally;
  2. a thread that communicates via socket with an external device to allow data exchange.

Is there a way to syncronize the XML_RPC server with the communication thread? (something like semaphores or threading lock method)

What i’m searching for is to avoid the XML_RPC server from serving the urp program when the communication thread is updating the data exchanged with the external device. If somenthing is not clear i will explain better the structure of my program.

Did you try the threading.Lock object in Python ?
https://docs.python.org/2/library/threading.html#lock-objects

1 Like

Thanks for advice, it work as expected now.