1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00

python: allow usage of communicate() without blocking

This commit is contained in:
Steffen Vogel 2020-06-07 18:53:26 +01:00 committed by Steffen Vogel
parent 92a2f2cfbf
commit f0bcf744e9

View file

@ -60,7 +60,7 @@ class SendThread(Thread):
self.sequence += 1
def communicate(rate, recv_cb=None, send_cb=None):
def communicate(rate, recv_cb=None, send_cb=None, wait=True):
if recv_cb:
rt = RecvThread(recv_cb)
@ -70,6 +70,7 @@ def communicate(rate, recv_cb=None, send_cb=None):
st = SendThread(send_cb, rate)
st.start()
if wait:
try:
while True:
time.sleep(1)