Exemple #1
0
        internal bool WaitForIO(IntPtr ovlapEvent)
        {
            //_lastError = (ushort)Marshal.GetLastWin32Error();

            //if (_lastError == CyConst.ERROR_SUCCESS) return true;  // The command completed

            //if (_lastError == CyConst.ERROR_IO_PENDING)
            {
                Int32 waitResult = PInvoke.WaitForSingleObject(ovlapEvent, TimeOut);

                if (waitResult == CyConst.WAIT_OBJECT_0)
                {
                    return(true);
                }

                if (waitResult == CyConst.WAIT_TIMEOUT)
                {
                    Abort();
                    // Wait for the stalled command to complete - should be done already
                    PInvoke.WaitForSingleObject(ovlapEvent, CyConst.INFINITE);
                }
            }

            return(false);
        }
Exemple #2
0
        public bool WaitForXfer(IntPtr ovlapEvent, uint tOut)
        {
            Int32 waitResult = PInvoke.WaitForSingleObject(ovlapEvent, tOut);

            if (waitResult == CyConst.WAIT_OBJECT_0)
            {
                return(true);
            }
            return(false);
        }
Exemple #3
0
        public bool WaitForXfer(IntPtr ovlapEvent, uint tOut)
        {
            _lastError = (ushort)Marshal.GetLastWin32Error();

            if (_lastError == CyConst.ERROR_SUCCESS)
            {
                return(true);                                      // The command completed
            }
            if (_lastError == CyConst.ERROR_IO_PENDING)
            {
                Int32 waitResult = PInvoke.WaitForSingleObject(ovlapEvent, tOut);
                if (waitResult == CyConst.WAIT_OBJECT_0)
                {
                    return(true);
                }
                if (waitResult == CyConst.WAIT_TIMEOUT)
                {
                    return(false);
                }
            }

            return(false);
        }