void native_dirmonitor_remove(Ref *r) { FileMonitor *fm = Value_ptr(r->v[INDEX_FILEMONITOR_STRUCT]); if (fm != NULL) { fm->valid = FALSE; CancelIo(fm->hDir); refresh_dirmonitor(fm, TRUE); if (!HasOverlappedIoCompleted(&fm->overlapped)) { SleepEx(5, TRUE); } CloseHandle(fm->hDir); CloseHandle(fm->overlapped.hEvent); FileMonitor_del(fm); r->v[INDEX_FILEMONITOR_STRUCT] = VALUE_NULL; } }
static u32 ser_read_internal( ser_handler id, u32 timeout ) { HANDLE hComm = id->hnd; DWORD readbytes = 0; DWORD dwRes = WaitForSingleObject( id->o.hEvent, timeout == SER_INF_TIMEOUT ? INFINITE : timeout ); if( dwRes == WAIT_OBJECT_0 ) { if( !GetOverlappedResult( hComm, &id->o, &readbytes, TRUE ) ) readbytes = 0; } else if( dwRes == WAIT_TIMEOUT ) { CancelIo( hComm ); GetOverlappedResult( hComm, &id->o, &readbytes, TRUE ); readbytes = 0; } ResetEvent( id->o.hEvent ); return readbytes; }
static __inline BOOL cancel_io(int _index) { if ((_index < 0) || (_index >= MAX_FDS)) { return FALSE; } if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE) || (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) { return TRUE; } if (CancelIoEx_Available) { return (*pCancelIoEx)(poll_fd[_index].handle, poll_fd[_index].overlapped); } if (_poll_fd[_index].thread_id == GetCurrentThreadId()) { return CancelIo(poll_fd[_index].handle); } usbi_warn(NULL, "Unable to cancel I/O that was started from another thread"); return FALSE; }
static void ser_windows_close (struct serial *scb) { struct ser_windows_state *state; /* Stop any pending selects. */ CancelIo ((HANDLE) _get_osfhandle (scb->fd)); state = scb->state; CloseHandle (state->ov.hEvent); CloseHandle (state->except_event); if (scb->fd < 0) return; close (scb->fd); scb->fd = -1; xfree (scb->state); }
VOID CFileMonitorRequest::StopCheck( ULONG_PTR aRequest ) { CFileMonitorRequest * req = (CFileMonitorRequest *)aRequest; if ( INVALID_HANDLE_VALUE != req->m_hMonitorPath ) { CancelIo( req->m_hMonitorPath ); for ( int i = 0 ; i < MONITOR_THREAD_STOP_MAX_RETRY_COUNT ; i++ ) { if ( TRUE == HasOverlappedIoCompleted(&req->m_overlapped) ) break; else SleepEx( 100 , TRUE ); } CloseHandle( req->m_hMonitorPath ); req->m_hMonitorPath = INVALID_HANDLE_VALUE; req->DecrementWorkCount( req->m_parent ); } }
bool SerialPort::event(QEvent *e) { if (e->type() != QEvent::User) return QObject::event(e); switch (static_cast<SerialEvent*>(e)->reason()){ case EventComplete:{ DWORD bytes; if (GetOverlappedResult(d->hPort, &d->over, &bytes, true)){ if (d->m_state == Read){ d->m_buff.pack(&d->m_char, 1); if (d->m_char == '\n') emit read_ready(); } if (d->m_state == Write){ emit write_ready(); d->m_state = Read; } if (d->m_state == Read){ d->m_state = StartRead; SetEvent(d->hEvent); } break; } close(); emit error(); break; } case EventTimeout:{ log(L_WARN, "IO timeout"); CancelIo(d->hPort); close(); emit error(); break; } case EventError:{ log(L_WARN, "IO error"); close(); emit error(); } } return true; }
static HANDLE open_device(const char *path, BOOL enumerate) { HANDLE handle; DWORD desired_access = (enumerate)? 0: (GENERIC_WRITE | GENERIC_READ); DWORD share_mode = (enumerate)? FILE_SHARE_READ|FILE_SHARE_WRITE: FILE_SHARE_READ; handle = CreateFileA(path, desired_access, share_mode, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED,/*FILE_ATTRIBUTE_NORMAL,*/ 0); CancelIo(handle); return handle; }
void SerialPort::writeLine(const char *data, unsigned read_time) { if (d->hPort == INVALID_HANDLE_VALUE){ emit error(); return; } switch (d->m_state){ case Read: case Write: CancelIo(d->hPort); break; default: break; } d->m_state = StartWrite; d->m_line = data; d->m_read_time = read_time; FlushFileBuffers(d->hPort); SetEvent(d->hEvent); }
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; } }
/*! Closes a serial port. This function has no effect if the serial port associated with the class is not currently open. */ void QextSerialPort::close() { QMutexLocker lock(mutex); if (isOpen()) { flush(); QIODevice::close(); // mark ourselves as closed CancelIo(Win_Handle); if (CloseHandle(Win_Handle)) Win_Handle = INVALID_HANDLE_VALUE; if (winEventNotifier) winEventNotifier->deleteLater(); _bytesToWrite = 0; foreach(OVERLAPPED* o, pendingWrites) { CloseHandle(o->hEvent); delete o; } pendingWrites.clear(); }
// Returns errcode (or 0 if successful) DWORD FinishCommand(BOOL boolresult) { DWORD errcode; DWORD waitcode; #ifdef VERBOSE_FUNCTION_DEVICE PrintLog("CDVDiso device: FinishCommand()"); #endif /* VERBOSE_FUNCTION_DEVICE */ if (boolresult == TRUE) { ResetEvent(waitevent.hEvent); return(0); } // ENDIF- Device is ready? Say so. errcode = GetLastError(); if (errcode == ERROR_IO_PENDING) { #ifdef VERBOSE_FUNCTION_DEVICE PrintLog("CDVDiso device: Waiting for completion."); #endif /* VERBOSE_FUNCTION_DEVICE */ waitcode = WaitForSingleObject(waitevent.hEvent, 10 * 1000); // 10 sec wait if ((waitcode == WAIT_FAILED) || (waitcode == WAIT_ABANDONED)) { errcode = GetLastError(); } else if (waitcode == WAIT_TIMEOUT) { errcode = 21; CancelIo(devicehandle); // Speculative Line } else { ResetEvent(waitevent.hEvent); return(0); // Success! } // ENDIF- Trouble waiting? (Or doesn't finish in 5 seconds?) } // ENDIF- Should we wait for the call to finish? ResetEvent(waitevent.hEvent); return(errcode); } // END DeviceCommand()
/* * Disconnect, but do not close, a pipe handle; and deregister * any pending waiter threads from its event handles. * * XXX: This must be called from primary thread, or lock held if not! */ void pipe_disconnect(pipe_instance_t *pp) { TRACE0(ENTER, "Entering pipe_disconnect"); if (pp == NULL) return; /* * Cancel pending I/O before deregistering the callback, * and disconnect the pipe, to avoid race conditions. * We also reset the event(s) to avoid being signalled for * things which haven't actually happened yet. * * XXX: To avoid races during shutdown, we may have to * NULL out the second argument to UnregisterWaitEx(). * We can't, however, do that from a service thread. */ if (pp->cwait != NULL) { UnregisterWaitEx(pp->cwait, pp->cevent); ResetEvent(pp->cevent); pp->cwait = NULL; } if (pp->rwait != NULL) { UnregisterWaitEx(pp->rwait, pp->revent); ResetEvent(pp->revent); pp->rwait = NULL; } if (pp->pipe != NULL) { CancelIo(pp->pipe); if (pp->state == PIPE_STATE_CONNECTED || pp->state == PIPE_STATE_LISTEN) { DisconnectNamedPipe(pp->pipe); } } pp->state = PIPE_STATE_INIT; TRACE0(ENTER, "Leaving pipe_disconnect"); }
// put back the IODesc to the free list and cancel all IO and put back FD bool IOProcessorUnregisterSocket(FD& fd) { IODesc* iod; BOOL ret; Log_Trace("fd = %d", fd.index); iod = &iods[fd.index]; iod->next = freeIods; freeIods = iod; ret = CancelIo((HANDLE)fd.sock); if (ret == 0) { ret = WSAGetLastError(); Log_Trace("CancelIo error %d", ret); return false; } return true; }
void Socket::CloseSocket() { if (m_s != INVALID_SOCKET) { #ifdef USE_WINDOWS_STYLE_SOCKETS # if defined(USE_WINDOWS8_API) BOOL result = CancelIoEx((HANDLE) m_s, NULL); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); CheckAndHandleError_int("closesocket", closesocket(m_s)); # else BOOL result = CancelIo((HANDLE) m_s); assert(result || (!result && GetLastError() == ERROR_NOT_FOUND)); CheckAndHandleError_int("closesocket", closesocket(m_s)); # endif #else CheckAndHandleError_int("close", close(m_s)); #endif m_s = INVALID_SOCKET; SocketChanged(); } }
/// Stops monitoring a directory. void DestroyWatch(WatchStruct* pWatch) { if (pWatch) { pWatch->mStopNow = TRUE; CancelIo(pWatch->mDirHandle); RefreshWatch(pWatch, true); if (!HasOverlappedIoCompleted(&pWatch->mOverlapped)) { SleepEx(5, TRUE); } CloseHandle(pWatch->mOverlapped.hEvent); CloseHandle(pWatch->mDirHandle); delete pWatch->mDirName; HeapFree(GetProcessHeap(), 0, pWatch); } }
void uv_tcp_close(uv_tcp_t* tcp) { int non_ifs_lsp; int close_socket = 1; /* * In order for winsock to do a graceful close there must not be * any pending reads. */ if (tcp->flags & UV_HANDLE_READ_PENDING) { /* Just do shutdown on non-shared sockets, which ensures graceful close. */ if (!(tcp->flags & UV_HANDLE_SHARED_TCP_SOCKET)) { shutdown(tcp->socket, SD_SEND); tcp->flags |= UV_HANDLE_SHUT; } else { /* Check if we have any non-IFS LSPs stacked on top of TCP */ non_ifs_lsp = (tcp->flags & UV_HANDLE_IPV6) ? uv_tcp_non_ifs_lsp_ipv6 : uv_tcp_non_ifs_lsp_ipv4; if (!non_ifs_lsp) { /* * Shared socket with no non-IFS LSPs, request to cancel pending I/O. * The socket will be closed inside endgame. */ CancelIo((HANDLE)tcp->socket); close_socket = 0; } } } tcp->flags &= ~(UV_HANDLE_READING | UV_HANDLE_LISTENING); if (close_socket) { closesocket(tcp->socket); tcp->flags |= UV_HANDLE_TCP_SOCKET_CLOSED; } if (tcp->reqs_pending == 0) { uv_want_endgame(tcp->loop, (uv_handle_t*)tcp); } }
int async_pipe_close(async_pipe_t pipe) { int err; Win32Pipe* o = (Win32Pipe*)pipe; // cancel ip CancelIo(o->pipe); // close pipe object assert(0 == o->ref); CloseHandle(o->pipe); err = (int)GetLastError(); // close event object if(o->overlap.hEvent) CloseHandle(o->overlap.hEvent); // free GlobalFree(o); return err; }
/*----------------------------------------------------------------------------- -- FUNCTION: server_download -- -- DATE: 2009-03-29 -- -- REVISIONS: March 29 - Jerrod, Added a sleep after each packet send so -- that the client can keep up with us. -- -- DESIGNER(S): Jaymz Boilard -- PROGRAMMER(S): Jaymz Boilard & Jerrod Hudson -- -- INTERFACE: server_download(WPARAM wParam, PTSTR fileName) -- -- RETURNS: void -- -- NOTES: The server's response when prompted by the client to service a -- download request. It opens the file, reading & sending packets until -- we reach end of file. -----------------------------------------------------------------------------*/ void server_download(WPARAM wParam, PTSTR fileName) { char outBuf[FILE_BUFF_SIZE]; DWORD bytesRead; HANDLE hFile; DWORD Flags = 0; /* Open the file */ if((hFile = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL)) == INVALID_HANDLE_VALUE) { MessageBox(ghWndMain, (LPCSTR)"Error opening file!", (LPCSTR)"Error!", MB_OK | MB_ICONSTOP); return; } while(TRUE) { memset(outBuf,'\0',FILE_BUFF_SIZE); ReadFile(hFile, outBuf, FILE_BUFF_SIZE, &bytesRead, NULL); if(bytesRead == 0) { /* End of file, close & exit. */ send(wParam, "Last Pkt\0", 9, 0); CancelIo(hFile); break; } if(send(wParam, outBuf, bytesRead, 0) == -1) { if (WSAGetLastError() != WSAEWOULDBLOCK) { MessageBox(ghWndMain, (LPCSTR)"send() failed.", (LPCSTR)"Error!", MB_OK | MB_ICONSTOP); closesocket(wParam); } } Sleep(1); /* Give the client some time to catch up with us */ } }
//////////////////////////////////////////////////////////////////////////////// // // FUNCTION: CIOCPServer::RemoveStaleClient // // DESCRIPTION: Client has died on us, close socket and remove context from our list // // INPUTS: // // NOTES: // // MODIFICATIONS: // // Name Date Version Comments // N T ALMOND 06042001 1.0 Origin // //////////////////////////////////////////////////////////////////////////////// void CIOCPServer::RemoveStaleClient(ClientContext* pContext, BOOL bGraceful) { CLock cs(m_cs, "RemoveStaleClient"); TRACE("CIOCPServer::RemoveStaleClient\n"); LINGER lingerStruct; // // If we're supposed to abort the connection, set the linger value // on the socket to 0. // if (!bGraceful ) { lingerStruct.l_onoff = 1; lingerStruct.l_linger = 0; setsockopt(pContext->m_Socket, SOL_SOCKET, SO_LINGER, (char *)&lingerStruct, sizeof(lingerStruct)); } // // Free context structures if (m_listContexts.Find(pContext)) { // Now close the socket handle. This will do an abortive or graceful close, as requested. CancelIo((HANDLE) pContext->m_Socket); closesocket(pContext->m_Socket ); pContext->m_Socket = INVALID_SOCKET; while (!HasOverlappedIoCompleted((LPOVERLAPPED)pContext)) Sleep(0); m_pNotifyProc((LPVOID) m_pFrame, pContext, NC_CLIENT_DISCONNECT); MoveToFreePool(pContext); } }
int wiiuse_io_read(struct wiimote_t* wm) { DWORD b, r; if (!wm || !WIIMOTE_IS_CONNECTED(wm)) return 0; if (!ReadFile(wm->dev_handle, wm->event_buf, sizeof(wm->event_buf), &b, &wm->hid_overlap)) { /* partial read */ b = GetLastError(); if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) { /* remote disconnect */ wiiuse_disconnected(wm); return 0; } r = WaitForSingleObject(wm->hid_overlap.hEvent, wm->timeout); if (r == WAIT_TIMEOUT) { /* timeout - cancel and continue */ if (*wm->event_buf) WIIUSE_WARNING("Packet ignored. This may indicate a problem (timeout is %i ms).", wm->timeout); CancelIo(wm->dev_handle); ResetEvent(wm->hid_overlap.hEvent); return 0; } else if (r == WAIT_FAILED) { WIIUSE_WARNING("A wait error occured on reading from wiimote %i.", wm->unid); return 0; } if (!GetOverlappedResult(wm->dev_handle, &wm->hid_overlap, &b, 0)) return 0; } ResetEvent(wm->hid_overlap.hEvent); return 1; }
void Filesystem::shutdownReadahead() { if(readahead_thread.get()!=NULL) { readahead_thread->stop(); Server->getThreadPool()->waitFor(readahead_thread_ticket); readahead_thread.reset(); } size_t num = 0; while (num_uncompleted_blocks > 0) { waitForCompletion(100); ++num; #ifdef _WIN32 if (num>10 && num_uncompleted_blocks > 0) { CancelIo(hVol); } #endif } }
// 读设备 USBHIDDLL_API int __stdcall USBHIDReadByte(USBHANDLE handle, BYTE* byte, int len) { DWORD numberOfByteRead = 0; if (handle != INVALID_HANDLE_VALUE) { CancelIo(handle); int Result = ReadFile (handle, byte, len, &numberOfByteRead, &HIDOverlapped); if (GetLastError() == ERROR_IO_PENDING) { WaitForSingleObject(handle, INFINITE); GetOverlappedResult(handle, &HIDOverlapped, &numberOfByteRead, FALSE); } } return numberOfByteRead; }
void CL_PipeListen_Impl::cancel_accept() { #ifdef WIN32 if (!async_io) throw CL_Exception("CL_PipeConnection is not in an async I/O state"); BOOL result = CancelIo(handle); if (result == FALSE) throw CL_Exception("CancelIo failed"); DWORD bytes_transfered = 0; result = GetOverlappedResult(handle, &accept_overlapped, &bytes_transfered, TRUE); if (result == TRUE) { result = DisconnectNamedPipe(handle); } else if (GetLastError() != ERROR_OPERATION_ABORTED) { throw CL_Exception("GetOverlappedResult failed"); } async_io = false; #endif }
static void ser_windows_close (struct serial *scb) { struct ser_windows_state *state; /* Stop any pending selects. On Windows 95 OS, CancelIo function does not exist. In that case, it can be replaced by a call to CloseHandle, but this is not necessary here as we do close the Windows handle by calling close (scb->fd) below. */ if (CancelIo) CancelIo ((HANDLE) _get_osfhandle (scb->fd)); state = scb->state; CloseHandle (state->ov.hEvent); CloseHandle (state->except_event); if (scb->fd < 0) return; close (scb->fd); scb->fd = -1; xfree (scb->state); }
/** * Called after a WaitForMultipleObjects returned in order to check for pending * events and stop whatever actions that rtPipePollStart() initiated. * * @returns Event mask or 0. * * @param hPipe The pipe handle. * @param fEvents The events we're polling for. * @param fFinalEntry Set if this is the final entry for this handle * in this poll set. This can be used for dealing * with duplicate entries. Only keep in mind that * this method is called in reverse order, so the * first call will have this set (when the entire * set was processed). * @param fHarvestEvents Set if we should check for pending events. */ uint32_t rtPipePollDone(RTPIPE hPipe, uint32_t fEvents, bool fFinalEntry, bool fHarvestEvents) { RTPIPEINTERNAL *pThis = hPipe; AssertPtrReturn(pThis, 0); AssertReturn(pThis->u32Magic == RTPIPE_MAGIC, 0); int rc = RTCritSectEnter(&pThis->CritSect); AssertRCReturn(rc, 0); Assert(pThis->cUsers > 0); /* Cancel the zero byte read. */ uint32_t fRetEvents = 0; if (pThis->fZeroByteRead) { CancelIo(pThis->hPipe); DWORD cbRead = 0; if ( !GetOverlappedResult(pThis->hPipe, &pThis->Overlapped, &cbRead, TRUE /*fWait*/) && GetLastError() != ERROR_OPERATION_ABORTED) fRetEvents = RTPOLL_EVT_ERROR; pThis->fIOPending = false; pThis->fZeroByteRead = false; } /* harvest events. */ fRetEvents |= rtPipePollCheck(pThis, fEvents); /* update counters. */ pThis->cUsers--; if (!pThis->cUsers) pThis->hPollSet = NIL_RTPOLLSET; RTCritSectLeave(&pThis->CritSect); return fRetEvents; }
/* * This function tries to read 'size' bytes of data. * It blocks until 'size' bytes of data have been read or after 1s has elapsed. * * It should only be used in the initialization stages, i.e. before the mainloop. */ int serial_recv(int id, void* pdata, unsigned int size) { DWORD dwBytesRead = 0; if(!ReadFile(serials[id].handle, (uint8_t*)pdata, size, NULL, &serials[id].rOverlapped)) { if(GetLastError() != ERROR_IO_PENDING) { printf("ReadFile failed with error %lu\n", GetLastError()); return -1; } int ret = WaitForSingleObject(serials[id].rOverlapped.hEvent, 1000); switch (ret) { case WAIT_OBJECT_0: if (!GetOverlappedResult(serials[id].handle, &serials[id].rOverlapped, &dwBytesRead, FALSE)) { printf("GetOverlappedResult failed with error %lu\n", GetLastError()); return -1; } break; case WAIT_TIMEOUT: CancelIo(serials[id].handle); printf("WaitForSingleObject failed: timeout expired.\n"); break; default: printf("WaitForSingleObject failed with error %lu\n", GetLastError()); return -1; } } else { dwBytesRead = size; } return dwBytesRead; }
static void stop_monitoring(LPVOID param) { BOOL already_stopped; WDM_PMonitor monitor; WDM_PEntry entry; monitor = (WDM_PMonitor)param; already_stopped = FALSE; WDM_DEBUG("Stopping the monitor!"); EnterCriticalSection(&monitor->lock); if ( ! monitor->running ) { already_stopped = TRUE; } else { monitor->running = FALSE; } LeaveCriticalSection(&monitor->lock); if (already_stopped) { WDM_DEBUG("Can't stop monitoring because it's already stopped (or it's never been started)!!"); return; } entry = monitor->head; while(entry != NULL) { CancelIo(entry->dir_handle); // Stop monitoring changes entry = entry->next; } SetEvent(monitor->stop_event); SetEvent(monitor->process_event); // The process code checks after the wait for an exit signal WaitForSingleObject(monitor->monitoring_thread, 10000); }
static void gst_ks_video_device_clear_buffers (GstKsVideoDevice * self) { GstKsVideoDevicePrivate *priv = GST_KS_VIDEO_DEVICE_GET_PRIVATE (self); guint i; if (priv->requests == NULL) return; /* Cancel pending requests */ CancelIo (priv->pin_handle); for (i = 0; i < priv->num_requests; i++) { ReadRequest *req = &g_array_index (priv->requests, ReadRequest, i); DWORD bytes_returned; GetOverlappedResult (priv->pin_handle, &req->overlapped, &bytes_returned, TRUE); } /* Clean up */ for (i = 0; i < priv->requests->len; i++) { ReadRequest *req = &g_array_index (priv->requests, ReadRequest, i); HANDLE ev = g_array_index (priv->request_events, HANDLE, i); g_free (req->buf_unaligned); if (ev) CloseHandle (ev); } g_array_free (priv->requests, TRUE); priv->requests = NULL; g_array_free (priv->request_events, TRUE); priv->request_events = NULL; }
DWORD WINAPI VlcStreamDiscardThread(__in LPVOID lpParameter) { HANDLE hPipe = (HANDLE)lpParameter; char tmpBuffer[IPTV_BUFFER_SIZE]; OVERLAPPED o; o.hEvent = CreateEvent( NULL, FALSE, FALSE, NULL); LogDebug("StreamDiscardThread start"); DWORD startRecvTime = GetTickCount(); do { DWORD cbBytesRead; ResetEvent(o.hEvent); o.Internal = o.InternalHigh = o.Offset = o.OffsetHigh = 0; BOOL fSuccess = ReadFile( hPipe, tmpBuffer, sizeof(tmpBuffer), &cbBytesRead, &o); if (GetLastError() == ERROR_IO_PENDING) { WaitForSingleObject(o.hEvent, 5000); fSuccess = GetOverlappedResult(hPipe, &o, &cbBytesRead, false); } LogDebug("StreamDiscardThread bytes read: %d", cbBytesRead); if (!fSuccess || cbBytesRead == 0) { CancelIo(hPipe); LogDebug("StreamDiscardThread eof"); break; } } while (abs((signed long)(GetTickCount() - startRecvTime)) < 10000); CloseHandle(o.hEvent); LogDebug("StreamDiscardThread end"); return 0; }
void XWinFileSystemNotification::PrepareDeleteChangeData(XWinChangeData *inData ) { // cancel pending io operation inData->fIsCanceled = true; if (inData->fTimer) { ::CancelWaitableTimer( inData->fTimer ); // This ensures we don't fire an event if we no longer care about changes } // pas besoin de CancelIoEx car c'est appele depuis la thread qui fait les IO. Et tant mieux car CancelIoEx blocke dans certains cas. BOOL ok = CancelIo( inData->fFolderHandle); #if WITH_ASSERT DWORD err = GetLastError(); if (!ok && err != ERROR_NOT_FOUND) { char buff[1024]; sprintf(buff,"CancelIoEx err=%i\r\n", err); OutputDebugString(buff); } #endif inData->fCallback = NULL; }