(self, handle, timeout, _is_cancel)
| 669 | return fut |
| 670 | |
| 671 | def _wait_for_handle(self, handle, timeout, _is_cancel): |
| 672 | self._check_closed() |
| 673 | |
| 674 | if timeout is None: |
| 675 | ms = _winapi.INFINITE |
| 676 | else: |
| 677 | # RegisterWaitForSingleObject() has a resolution of 1 millisecond, |
| 678 | # round away from zero to wait *at least* timeout seconds. |
| 679 | ms = math.ceil(timeout * 1e3) |
| 680 | |
| 681 | # We only create ov so we can use ov.address as a key for the cache. |
| 682 | ov = _overlapped.Overlapped(NULL) |
| 683 | wait_handle = _overlapped.RegisterWaitWithQueue( |
| 684 | handle, self._iocp, ov.address, ms) |
| 685 | if _is_cancel: |
| 686 | f = _WaitCancelFuture(ov, handle, wait_handle, loop=self._loop) |
| 687 | else: |
| 688 | f = _WaitHandleFuture(ov, handle, wait_handle, self, |
| 689 | loop=self._loop) |
| 690 | if f._source_traceback: |
| 691 | del f._source_traceback[-1] |
| 692 | |
| 693 | def finish_wait_for_handle(trans, key, ov): |
| 694 | # Note that this second wait means that we should only use |
| 695 | # this with handles types where a successful wait has no |
| 696 | # effect. So events or processes are all right, but locks |
| 697 | # or semaphores are not. Also note if the handle is |
| 698 | # signalled and then quickly reset, then we may return |
| 699 | # False even though we have not timed out. |
| 700 | return f._poll() |
| 701 | |
| 702 | self._cache[ov.address] = (f, ov, 0, finish_wait_for_handle) |
| 703 | return f |
| 704 | |
| 705 | def _register_with_iocp(self, obj): |
| 706 | # To get notifications of finished ops on this objects sent to the |
no test coverage detected