5 internal class _IOCompletionCallback
12 private uint _errorCode;
14 private uint _numBytes;
21 [SecuritySafeCritical]
22 static _IOCompletionCallback()
24 _ccb = IOCompletionCallback_Context;
28 internal unsafe _IOCompletionCallback(
IOCompletionCallback ioCompletionCallback, ref StackCrawlMark stackMark)
30 _ioCompletionCallback = ioCompletionCallback;
35 internal unsafe
static void IOCompletionCallback_Context(
object state)
37 _IOCompletionCallback iOCompletionCallback = (_IOCompletionCallback)state;
38 iOCompletionCallback._ioCompletionCallback(iOCompletionCallback._errorCode, iOCompletionCallback._numBytes, iOCompletionCallback._pOVERLAP);
42 internal unsafe
static void PerformIOCompletionCallback(uint errorCode, uint numBytes,
NativeOverlapped* pOVERLAP)
46 Overlapped overlapped = OverlappedData.GetOverlappedFromNative(pOVERLAP).m_overlapped;
47 _IOCompletionCallback iocbHelper = overlapped.iocbHelper;
48 if (iocbHelper ==
null || iocbHelper._executionContext ==
null || iocbHelper._executionContext.IsDefaultFTContext(ignoreSyncCtx:
true))
51 userCallback(errorCode, numBytes, pOVERLAP);
55 iocbHelper._errorCode = errorCode;
56 iocbHelper._numBytes = numBytes;
57 iocbHelper._pOVERLAP = pOVERLAP;
58 using (
ExecutionContext executionContext = iocbHelper._executionContext.CreateCopy())
63 OverlappedData.CheckVMForIOPacket(out pOVERLAP, out errorCode, out numBytes);
65 while (pOVERLAP !=
null);
delegate void ContextCallback(object state)
Represents a method to be called within a new context.
Provides a managed representation of a Win32 OVERLAPPED structure, including methods to transfer info...
unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP)
Receives the error code, number of bytes, and overlapped value type when an I/O operation completes o...
Manages the execution context for the current thread. This class cannot be inherited.
static void Run(ExecutionContext executionContext, ContextCallback callback, object state)
Runs a method in a specified execution context on the current thread.
static ExecutionContext Capture()
Captures the execution context from the current thread.
Provides an explicit layout that is visible from unmanaged code and that will have the same layout as...