def testCompletionPortsQueued(self): class Foo: pass io_req_port = win32file.CreateIoCompletionPort(-1, None, 0, 0) overlapped = pywintypes.OVERLAPPED() overlapped.object = Foo() win32file.PostQueuedCompletionStatus(io_req_port, 0, 99, overlapped) errCode, bytes, key, overlapped = \ win32file.GetQueuedCompletionStatus(io_req_port, win32event.INFINITE) self.failUnlessEqual(errCode, 0) self.failUnless(isinstance(overlapped.object, Foo))
def run(self): global completion_port, running while running: win32file.PostQueuedCompletionStatus(completion_port, 0, 0, None) win32event.WaitForSingleObject(self.handle, win32event.INFINITE)
def run(self): global completion_port, running logger.info('timer thread started') while running: win32file.PostQueuedCompletionStatus(completion_port, 0, 0, None) win32event.WaitForSingleObject(self.handle, win32event.INFINITE)
def post(self): win32file.PostQueuedCompletionStatus(self._port, numberOfbytes, completionKey, overlapped)
def post(self): """will cause wait() to return with the given information""" win32file.PostQueuedCompletionStatus(self._port, 0, 0, self._post_overlapped)