core: Latch._wake improvements

os.write() can fail with EINTR due to signals, so wrap it in
io_op(). Closes #483.

Masking EBADF looks like it is/was almost certainly papering over a bug,
remove it and suffer the bug reports. Closes #495.
issue510
David Wilson 6 years ago
parent 407294cd79
commit 0c0d34241b

@ -2220,12 +2220,8 @@ class Latch(object):
self._lock.release() self._lock.release()
def _wake(self, wsock, cookie): def _wake(self, wsock, cookie):
try: written, disconnected = io_op(os.write, wsock.fileno(), cookie)
os.write(wsock.fileno(), cookie) assert written == len(cookie) and not disconnected
except OSError:
e = sys.exc_info()[1]
if e.args[0] != errno.EBADF:
raise
def __repr__(self): def __repr__(self):
return 'Latch(%#x, size=%d, t=%r)' % ( return 'Latch(%#x, size=%d, t=%r)' % (

Loading…
Cancel
Save