Exemple #1
0
 private void CancelOverlapped(SafeFileHandle handle, ManualResetEvent completedEvent)
 {
     lock (_cancelIOLock)
     {
         if (!completedEvent.WaitOne(OVERLAPPED_TIMEOUT) && handle != null && !handle.IsClosed && !handle.IsInvalid)
         {
             InteropKernel32.CancelIo(handle);
         }
     }
 }
Exemple #2
0
        public void WriteClear(uint controlCode)
        {
            // cancel pending operations
            lock (_cancelIOLock)
            {
                InteropKernel32.CancelIo(_readHandle);
                InteropKernel32.CancelIo(_writeHandle);
            }

            WriteControl(controlCode, null);
        }