Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XOverlappedAsyncResult.cs
Go to the documentation of this file.
1using System;
3
5
7{
8 private object asyncState;
9
11
12 private bool isCompleted;
13
14 private uint kernelHandle;
15
16 private bool endHasBeenCalled;
17
18 private bool isReusable;
19
20 private AsyncOperationCleanup kernelHandleCleanup;
21
22 object IAsyncResult.AsyncState => asyncState;
23
24 WaitHandle IAsyncResult.AsyncWaitHandle => asyncWaitHandle;
25
26 bool IAsyncResult.CompletedSynchronously => false;
27
28 bool IAsyncResult.IsCompleted => isCompleted;
29
31
32 internal bool IsCompleted
33 {
34 set
35 {
37 }
38 }
39
40 internal uint KernelHandle => kernelHandle;
41
42 internal bool IsReusable => isReusable;
43
44 internal XOverlappedAsyncResult(object asyncState, uint kernelHandle, bool isReusable, AsyncOperationCleanup kernelHandleCleanup)
45 {
46 this.asyncState = asyncState;
47 this.kernelHandle = kernelHandle;
48 this.isReusable = isReusable;
49 this.kernelHandleCleanup = kernelHandleCleanup;
50 if (isReusable)
51 {
52 asyncWaitHandle = new AutoResetEvent(initialState: false);
53 }
54 else
55 {
56 asyncWaitHandle = new ManualResetEvent(initialState: false);
57 }
58 }
59
67
69 {
70 if (result == null)
71 {
72 throw new ArgumentNullException("result");
73 }
74 if (!(result is XOverlappedAsyncResult xOverlappedAsyncResult))
75 {
77 }
78 if (xOverlappedAsyncResult.endHasBeenCalled)
79 {
81 }
82 xOverlappedAsyncResult.endHasBeenCalled = true;
83 xOverlappedAsyncResult.AsyncWaitHandle.WaitOne();
84 GC.SuppressFinalize(xOverlappedAsyncResult);
85 return xOverlappedAsyncResult;
86 }
87}
static bool OperationStillPending(XOverlappedAsyncResult result)
static XOverlappedAsyncResult PrepareForEndFunction(IAsyncResult result)
XOverlappedAsyncResult(object asyncState, uint kernelHandle, bool isReusable, AsyncOperationCleanup kernelHandleCleanup)
static void SuppressFinalize(object obj)
Definition GC.cs:202
Definition GC.cs:8