From 5825c9e147a9a3093505e3ed7014c6eef0f99254 Mon Sep 17 00:00:00 2001 From: cliechti Date: Sat, 12 Oct 2013 04:03:16 +0000 Subject: [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 --- CHANGES.txt | 1 + serial/serialposix.py | 5 +++++ 2 files changed, 6 insertions(+) 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: -- cgit v1.2.1