System.Threading._IOCompletionCallback.PerformIOCompletionCallback C# (CSharp) Method

PerformIOCompletionCallback() static private method

static private PerformIOCompletionCallback ( uint errorCode, uint numBytes, NativeOverlapped pOVERLAP ) : void
errorCode uint
numBytes uint
pOVERLAP NativeOverlapped
return void
            static unsafe internal void PerformIOCompletionCallback(uint errorCode, // Error code
                                                                                uint numBytes, // No. of bytes transferred 
                                                                                NativeOverlapped* pOVERLAP // ptr to OVERLAP structure
                                                                                )
            {
                Overlapped overlapped = OverlappedData.GetOverlappedFromNative(pOVERLAP).m_overlapped;
                _IOCompletionCallback helper  = overlapped.iocbHelper;

                if (helper == null || helper._executionContext == null || helper._executionContext.IsDefaultFTContext())
                {
        	      // We got here because of UnsafePack (or) Pack with EC flow supressed
                    IOCompletionCallback callback = overlapped.UserCallback;
                    callback( errorCode,  numBytes,  pOVERLAP);
                }
                else
                {
                    // We got here because of Pack
                    helper._errorCode = errorCode;
                    helper._numBytes = numBytes;
                    helper._pOVERLAP = pOVERLAP;
                    ExecutionContext.Run(helper._executionContext.CreateCopy(), _ccb, helper);
                }                    
            }
        };