summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/windows_events.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2013-11-24 22:05:57 (GMT)
committerLarry Hastings <larry@hastings.org>2013-11-24 22:05:57 (GMT)
commit99e101013fa36da37e47a5a18b5a62d621b0efb9 (patch)
treef603004433e242a1eb26573cd9ec54846229d071 /Lib/asyncio/windows_events.py
parentd34b620cc3b8b2326b511f98b0ca439ad97b83b8 (diff)
parent2480c2ed593a164fe3a4821a13d5867a0a7102ed (diff)
downloadcpython-99e101013fa36da37e47a5a18b5a62d621b0efb9.zip
cpython-99e101013fa36da37e47a5a18b5a62d621b0efb9.tar.gz
cpython-99e101013fa36da37e47a5a18b5a62d621b0efb9.tar.bz2
Merged 3.4.0b1 release head back into trunk.
Diffstat (limited to 'Lib/asyncio/windows_events.py')
-rw-r--r--Lib/asyncio/windows_events.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
index 64fe386..b2ed241 100644
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -327,14 +327,21 @@ class IocpProactor:
handle, self._iocp, ov.address, ms)
f = _WaitHandleFuture(wh, loop=self._loop)
- def finish(timed_out, _, ov):
+ def finish(trans, key, ov):
if not f.cancelled():
try:
_overlapped.UnregisterWait(wh)
except OSError as e:
if e.winerror != _overlapped.ERROR_IO_PENDING:
raise
- return not timed_out
+ # Note that this second wait means that we should only use
+ # this with handles types where a successful wait has no
+ # effect. So events or processes are all right, but locks
+ # or semaphores are not. Also note if the handle is
+ # signalled and then quickly reset, then we may return
+ # False even though we have not timed out.
+ return (_winapi.WaitForSingleObject(handle, 0) ==
+ _winapi.WAIT_OBJECT_0)
self._cache[ov.address] = (f, ov, None, finish)
return f