diff --git a/devices/clients/comms_client.py b/devices/clients/comms_client.py index a44aa024a06be9defbb37c486e78498ae8aa9f93..00234042b63d88173da49c2f3a49ffcedd5e654b 100644 --- a/devices/clients/comms_client.py +++ b/devices/clients/comms_client.py @@ -152,7 +152,18 @@ class AsyncCommClient(object): def __init__(self, fault_func, event_loop=None): """ + Create an Asynchronous communication client. + fault_func: Function to call to put the device to FAULT if an error is detected. + event_loop: Aysncio event loop to use. If None, a new event loop is created and + run in a separate thread. Only share event loops if any of the functions + executed doesn't stall, as asyncio used a cooperative multitasking model. + + If the executed functions can stall (for a bit), use a dedicated loop to avoid + interfering with other users of the event loop. + + All coroutines need to be executed in this loop, which wil also be stored + as the `event_loop` member of this object. """ self.fault_func = fault_func self.running = False