diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2013-10-12 04:03:16 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2013-10-12 04:03:16 +0000 |
commit | 5825c9e147a9a3093505e3ed7014c6eef0f99254 (patch) | |
tree | dbeef99a1c196d11265e51529a2097fa73b5d2f8 | |
parent | 9950074fc29131d3111d5cef4e8759457670425d (diff) | |
download | pyserial-5825c9e147a9a3093505e3ed7014c6eef0f99254.tar.gz |
[Bug pyserial:151] Serial.write() without a timeout uses 100% CPU on POSIX
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@473 f19166aa-fa4f-0410-85c2-fa1106f25c8a
-rw-r--r-- | CHANGES.txt | 1 | ||||
-rw-r--r-- | serial/serialposix.py | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 7091cc1..16def23 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -463,6 +463,7 @@ Bugfixes (posix): - [Bug pyserial:137] Patch to add non-standard baudrates to Cygwin - [Bug pyserial:141] open: Pass errno from IOError to SerialException - [Bug pyserial:125] Undefined 'base' on list_ports_posix.py, function usb_lsusb +- [Bug pyserial:151] Serial.write() without a timeout uses 100% CPU on POSIX - [Patch pyserial:30] [PATCH 1/1] serial.Serial() should not raise IOError. Bugfixes (win32): diff --git a/serial/serialposix.py b/serial/serialposix.py index 131e31b..fa5c999 100644 --- a/serial/serialposix.py +++ b/serial/serialposix.py @@ -506,6 +506,11 @@ class PosixSerial(SerialBase): _, ready, _ = select.select([], [self.fd], [], timeleft) if not ready: raise writeTimeoutError + else: + # wait for write operation + _, ready, _ = select.select([], [self.fd], [], None) + if not ready: + raise SerialException('write failed (select)') d = d[n:] tx_len -= n except OSError, v: |