# Synchronize a XML-RPC server with threads

**URL:** <https://forum.universal-robots.com/t/synchronize-a-xml-rpc-server-with-threads/898>\
**Category:** URCaps SDK\
**Created:** [June 21, 2017, 9:14am UTC](https://forum.universal-robots.com/t/synchronize-a-xml-rpc-server-with-threads/898 "2017-06-21T09:14:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon60565098](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@anon60565098](https://forum.universal-robots.com/u/anon60565098)\
**Post date:** [June 21, 2017, 9:14am UTC](https://forum.universal-robots.com/t/synchronize-a-xml-rpc-server-with-threads/898/1 "2017-06-21T09:14:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon58863070](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon58863070](https://forum.universal-robots.com/u/anon58863070)\
**Post date:** [June 21, 2017, 9:53am UTC](https://forum.universal-robots.com/t/synchronize-a-xml-rpc-server-with-threads/898/2 "2017-06-21T09:53:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon60565098](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@anon60565098](https://forum.universal-robots.com/u/anon60565098)\
**Post date:** [June 21, 2017, 3:43pm UTC](https://forum.universal-robots.com/t/synchronize-a-xml-rpc-server-with-threads/898/3 "2017-06-21T15:43:10Z")

</div>

Thanks for advice, it work as expected now.
