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:
parent
92a2f2cfbf
commit
f0bcf744e9
1 changed files with 7 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue