void HandleStream::cancelRead() { m_cancelRead = true; if (m_ioManager) { m_ioManager->cancelEvent(m_hFile, &m_readEvent); } else { if (!pCancelIoEx(m_hFile, NULL)) MORDOR_THROW_EXCEPTION_FROM_LAST_ERROR_API("CancelIoEx"); } }
static void win32iocp_cancel (struct event *ev, unsigned int rw_flags) { if (!pCancelIoEx) { CancelIo(ev->fd); rw_flags = (EVENT_READ | EVENT_WRITE); } if ((rw_flags & EVENT_READ) && ev->w.iocp.rov) { if (pCancelIoEx) pCancelIoEx(ev->fd, (OVERLAPPED *) ev->w.iocp.rov); ev->w.iocp.rov->ev = NULL; ev->w.iocp.rov = NULL; ev->flags &= ~EVENT_RPENDING; } if ((rw_flags & EVENT_WRITE) && ev->w.iocp.wov) { if (pCancelIoEx) pCancelIoEx(ev->fd, (OVERLAPPED *) ev->w.iocp.wov); ev->w.iocp.wov->ev = NULL; ev->w.iocp.wov = NULL; ev->flags &= ~EVENT_WPENDING; } }
static void uv__fast_poll_close(uv_loop_t* loop, uv_poll_t* handle) { handle->events = 0; if (handle->submitted_events_1 == 0 && handle->submitted_events_2 == 0) { uv_want_endgame(loop, (uv_handle_t*) handle); } else { /* Try to cancel outstanding poll requests. */ if (pCancelIoEx) { /* Use CancelIoEx to cancel poll requests if available. */ if (handle->submitted_events_1) pCancelIoEx((HANDLE) handle->socket, &handle->poll_req_1.overlapped); if (handle->submitted_events_2) pCancelIoEx((HANDLE) handle->socket, &handle->poll_req_2.overlapped); } else if (handle->submitted_events_1 | handle->submitted_events_2) { /* Execute another unique poll to force the others to return. */ uv__fast_poll_cancel_poll_reqs(loop, handle); } } }
void HandleStream::cancelWrite() { m_cancelWrite = true; if (m_ioManager) { m_ioManager->cancelEvent(m_hFile, &m_writeEvent); } else { MORDOR_ASSERT(supportsCancel()); if (!pCancelIoEx(m_hFile, NULL)) MORDOR_THROW_EXCEPTION_FROM_LAST_ERROR_API("CancelIoEx"); } }
bool HandleStream::supportsCancel() { if (m_ioManager) return true; if (!g_supportsCancel && !g_queriedSupportsCancel) { BOOL bRet = pCancelIoEx(INVALID_HANDLE_VALUE, NULL); MORDOR_ASSERT(!bRet); g_supportsCancel = GetLastError() != ERROR_CALL_NOT_IMPLEMENTED; g_queriedSupportsCancel = true; } return g_supportsCancel; }
static void win32iocr_cancel (struct event_queue *evq, struct event *ev) { struct win32overlapped *ov = ev->w.ov; ov->e.ev = NULL; ev->w.ov = NULL; ev->flags &= ~EVENT_AIO_PENDING; if (pCancelIoEx) pCancelIoEx(ev->fd, (OVERLAPPED *) ov); else win32iocr_apc_put(win32iocr_apc_cancel, evq, (ULONG_PTR) ev->fd); }