本文整理汇总了Python中serial.win32.CancelIoEx方法的典型用法代码示例。如果您正苦于以下问题:Python win32.CancelIoEx方法的具体用法?Python win32.CancelIoEx怎么用?Python win32.CancelIoEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serial.win32
的用法示例。
在下文中一共展示了win32.CancelIoEx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _cancel_overlapped_io
# 需要导入模块: from serial import win32 [as 别名]
# 或者: from serial.win32 import CancelIoEx [as 别名]
def _cancel_overlapped_io(self, overlapped):
"""Cancel a blocking read operation, may be called from other thread"""
# check if read operation is pending
rc = win32.DWORD()
err = win32.GetOverlappedResult(
self._port_handle,
ctypes.byref(overlapped),
ctypes.byref(rc),
False)
if not err and win32.GetLastError() in (win32.ERROR_IO_PENDING, win32.ERROR_IO_INCOMPLETE):
# cancel, ignoring any errors (e.g. it may just have finished on its own)
win32.CancelIoEx(self._port_handle, overlapped)