issue #156: don't decrement `waking` if we timed out rather than being woken.

pull/167/head
David Wilson 7 years ago
parent 07a8994ff5
commit 2c22c41819

@ -925,9 +925,9 @@ item.
:py:meth:`mitogen.core.Latch.put`.
**4. Wake, Non-empty**
On wake it re-acquires `lock`, removes itself from `sleeping`, decrementing
`waking`, throws :py:class:`mitogen.core.TimeoutError` if no byte was
written, otherwise pops and returns the first item in `queue` that is
On wake it re-acquires `lock`, removes itself from `sleeping`, throws
:py:class:`mitogen.core.TimeoutError` if no byte was written, decrements
`waking`, then pops and returns the first item in `queue` that is
guaranteed to exist.

@ -957,11 +957,11 @@ class Latch(object):
self._lock.acquire()
try:
self._sleeping.remove(_tls.wsock)
self._waking -= 1
if self.closed:
raise LatchError()
if not rfds:
raise TimeoutError()
self._waking -= 1
if _tls.rsock.recv(2) != '\x7f':
raise LatchError('internal error: received >1 wakeups')
try:

Loading…
Cancel
Save