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()
def _wake(self, wsock, cookie):
try:
os.write(wsock.fileno(), cookie)
except OSError:
e = sys.exc_info()[1]
if e.args[0] != errno.EBADF:
raise
written, disconnected = io_op(os.write, wsock.fileno(), cookie)
assert written == len(cookie) and not disconnected
def __repr__(self):
return 'Latch(%#x, size=%d, t=%r)' % (

Loading…
Cancel
Save