Commit 2c22c418 authored by David Wilson's avatar David Wilson

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

parent 07a8994f
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment