summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2023-08-23 16:25:02 +0200
committerLoic Guegan <loic.guegan@mailbox.org>2023-08-23 16:25:02 +0200
commitb2dfe627589fa29eaea1f4a7d390aded4462b78b (patch)
treecc7a3a3a9cddcee1bffc7b854d089e8003b8b831
parent0d5c89c5951b7b6dd0106eafdf3fd51705377aa6 (diff)
Set threads as daemons
-rw-r--r--esds/simulator.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/esds/simulator.py b/esds/simulator.py
index b3bbfc2..93d8e81 100644
--- a/esds/simulator.py
+++ b/esds/simulator.py
@@ -85,7 +85,8 @@ class Simulator:
exit(1)
node=Node(src, interfaces, grp)
self.nodes.append(node)
- thread=threading.Thread(target=node.run,args=[args]) # There must be "daemon=True" as a parameter, but we removed it to be compatible with older version of python
+ thread=threading.Thread(target=node.run,args=[args])
+ thread.setDaemon(True) # May not work on old version of pythons but allow to kill threads when main thread ends (see Node.abort())
thread.start()
def log(self,msg,node=None):