Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ThreadPoolBoundHandleOverlapped.cs
Go to the documentation of this file.
1namespace System.Threading;
2
4{
6
8
9 internal readonly object _userState;
10
12
14
16
17 internal bool _completed;
18
19 public unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated, bool flowExecutionContext)
20 {
21 _userCallback = callback;
23 _preAllocated = preAllocated;
24 _nativeOverlapped = (flowExecutionContext ? Pack(s_completionCallback, pinData) : UnsafePack(s_completionCallback, pinData));
27 }
28
29 private unsafe static void CompletionCallback(uint errorCode, uint numBytes, NativeOverlapped* nativeOverlapped)
30 {
31 ThreadPoolBoundHandleOverlapped threadPoolBoundHandleOverlapped = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(nativeOverlapped);
32 if (threadPoolBoundHandleOverlapped._completed)
33 {
35 }
36 threadPoolBoundHandleOverlapped._completed = true;
37 if (threadPoolBoundHandleOverlapped._boundHandle == null)
38 {
40 }
41 threadPoolBoundHandleOverlapped._userCallback(errorCode, numBytes, nativeOverlapped);
42 }
43}
static string InvalidOperation_NativeOverlappedReused
Definition SR.cs:1470
static string Argument_NativeOverlappedAlreadyFree
Definition SR.cs:788
Definition SR.cs:7
unsafe NativeOverlapped * UnsafePack(IOCompletionCallback? iocb)
static unsafe Overlapped Unpack(NativeOverlapped *nativeOverlappedPtr)
unsafe NativeOverlapped * Pack(IOCompletionCallback? iocb)
Definition Overlapped.cs:90
static unsafe readonly IOCompletionCallback s_completionCallback
unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated, bool flowExecutionContext)
static unsafe void CompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *nativeOverlapped)
unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP)