internal static unsafe void PerformIOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP) { do { Overlapped overlapped = OverlappedData.GetOverlappedFromNative(pOVERLAP).m_overlapped; _IOCompletionCallback iocbHelper = overlapped.iocbHelper; if (((iocbHelper == null) || (iocbHelper._executionContext == null)) || iocbHelper._executionContext.IsDefaultFTContext()) { overlapped.UserCallback(errorCode, numBytes, pOVERLAP); } else { iocbHelper._errorCode = errorCode; iocbHelper._numBytes = numBytes; iocbHelper._pOVERLAP = pOVERLAP; ExecutionContext.Run(iocbHelper._executionContext.CreateCopy(), _ccb, iocbHelper); } OverlappedData.CheckVMForIOPacket(out pOVERLAP, out errorCode, out numBytes); }while (pOVERLAP != null); }
internal static unsafe void PerformIOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP) { do { Overlapped overlapped = OverlappedData.GetOverlappedFromNative(pOVERLAP).m_overlapped; _IOCompletionCallback iocbHelper = overlapped.iocbHelper; if (iocbHelper == null || iocbHelper._executionContext == null || iocbHelper._executionContext.IsDefaultFTContext(true)) { overlapped.UserCallback(errorCode, numBytes, pOVERLAP); } else { iocbHelper._errorCode = errorCode; iocbHelper._numBytes = numBytes; iocbHelper._pOVERLAP = pOVERLAP; using (ExecutionContext copy = iocbHelper._executionContext.CreateCopy()) ExecutionContext.Run(copy, _IOCompletionCallback._ccb, (object)iocbHelper, true); } OverlappedData.CheckVMForIOPacket(out pOVERLAP, out errorCode, out numBytes); }while ((IntPtr)pOVERLAP != IntPtr.Zero); }