Skip to content
Snippets Groups Projects
Commit 1e5ee8c2 authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-412: Added comments explaining event loop for AsyncCommClient

parent be0b2ec3
No related branches found
No related tags found
1 merge request!142L2SS-412: Use asyncio for opcua and other clients
...@@ -152,7 +152,18 @@ class AsyncCommClient(object): ...@@ -152,7 +152,18 @@ class AsyncCommClient(object):
def __init__(self, fault_func, event_loop=None): 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.fault_func = fault_func
self.running = False self.running = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment