System.IO.FileStream.AsyncCopyToAwaitable.IOCallback C# (CSharp) Méthode

IOCallback() static private méthode

Overlapped callback: store the results, then invoke the continuation delegate.
static private IOCallback ( uint errorCode, uint numBytes, NativeOverlapped pOVERLAP ) : void
errorCode uint
numBytes uint
pOVERLAP System.Threading.NativeOverlapped
Résultat void
            internal unsafe static void IOCallback(uint errorCode, uint numBytes, NativeOverlapped* pOVERLAP)
            {
                var awaitable = (AsyncCopyToAwaitable)ThreadPoolBoundHandle.GetNativeOverlappedState(pOVERLAP);

                Debug.Assert(awaitable._continuation != s_sentinel, "Sentinel must not have already been set as the continuation");
                awaitable._errorCode = errorCode;
                awaitable._numBytes = numBytes;

                (awaitable._continuation ?? Interlocked.CompareExchange(ref awaitable._continuation, s_sentinel, null))?.Invoke();
            }