summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/windows_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-25 22:58:34 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-25 22:58:34 (GMT)
commit51e44ea66aefb4229e506263acf40d35596d279c (patch)
tree87cc5c3248c5885f56d035dc161f04b6c0499b42 /Lib/asyncio/windows_events.py
parent5a2146a2fdb9b8adf6472f1bedbba68c41bab232 (diff)
downloadcpython-51e44ea66aefb4229e506263acf40d35596d279c.zip
cpython-51e44ea66aefb4229e506263acf40d35596d279c.tar.gz
cpython-51e44ea66aefb4229e506263acf40d35596d279c.tar.bz2
Tulip issue 196: _OverlappedFuture.set_result() now clears its reference to the
overlapped object. IocpProactor._poll() now also ignores false alarms: GetQueuedCompletionStatus() returns the overlapped but it is still pending.
Diffstat (limited to 'Lib/asyncio/windows_events.py')
-rw-r--r--Lib/asyncio/windows_events.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
index 65ecf34..3aa142c 100644
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -77,6 +77,10 @@ class _OverlappedFuture(futures.Future):
super().set_exception(exception)
self._cancel_overlapped()
+ def set_result(self, result):
+ super().set_result(result)
+ self._ov = None
+
class _WaitHandleFuture(futures.Future):
"""Subclass of Future which represents a wait handle."""
@@ -478,6 +482,13 @@ class IocpProactor:
_winapi.CloseHandle(key)
ms = 0
continue
+
+ if ov.pending:
+ # False alarm: the overlapped operation is not completed.
+ # FIXME: why do we get false alarms?
+ self._cache[address] = (f, ov, obj, callback)
+ continue
+
if obj in self._stopped_serving:
f.cancel()
elif not f.cancelled():
@@ -489,11 +500,6 @@ class IocpProactor:
else:
f.set_result(value)
self._results.append(f)
- # FIXME, tulip issue #196: add _OverlappedFuture.set_result()
- # method to clear the refrence, don't do it here (f may
- # by a _WaitHandleFuture). Problem: clearing the reference
- # in _register() if ov.pedding is False leads to weird bugs.
- f._ov = None
ms = 0
def _stop_serving(self, obj):