Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix polling limitation to send messages #198

Open
wants to merge 2 commits into
base: rc_3.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pyluos/io/serial_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def write(self, data):

def close(self):
self._running = False
self._poll_loop.join()
self._poll_loop.join(timeout = 1)

self._serial.close()

Expand Down Expand Up @@ -121,6 +121,10 @@ def extract_line(s):
while self._running:
to_read = self._serial.in_waiting

if to_read == 0:
time.sleep(self.period)
continue

s = self._serial.read(to_read)
buff = buff + s

Expand Down
4 changes: 2 additions & 2 deletions pyluos/io/ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def is_ready(self):

def recv(self):
try:
data = self._msg.get(block = False)
data = self._msg.get(True, 0.01)
except queue.Empty:
data = None
return data
Expand All @@ -73,7 +73,7 @@ def write(self, data):

def close(self):
self._running = False
self._poll_loop.join(timeout = 1)
self._poll_loop.join(timeout = 2)
self._ws.close()

def _poll(self):
Expand Down