Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
OverlappedData.cs
Go to the documentation of this file.
1
using
System.Runtime.CompilerServices
;
2
3
namespace
System.Threading
;
4
5
internal
sealed
class
OverlappedData
6
{
7
internal
IAsyncResult
_asyncResult
;
8
9
internal
object
_callback
;
10
11
internal
readonly
Overlapped
_overlapped
;
12
13
private
object
_userObject
;
14
15
private
unsafe readonly
NativeOverlapped
*
_pNativeOverlapped
;
16
17
private
IntPtr
_eventHandle
;
18
19
private
int
_offsetLow
;
20
21
private
int
_offsetHigh
;
22
23
internal
unsafe ref
int
OffsetLow
24
{
25
get
26
{
27
if
(
_pNativeOverlapped
==
null
)
28
{
29
return
ref
_offsetLow
;
30
}
31
return
ref
_pNativeOverlapped
->
OffsetLow
;
32
}
33
}
34
35
internal
unsafe ref
int
OffsetHigh
36
{
37
get
38
{
39
if
(
_pNativeOverlapped
==
null
)
40
{
41
return
ref
_offsetHigh
;
42
}
43
return
ref
_pNativeOverlapped
->
OffsetHigh
;
44
}
45
}
46
47
internal
unsafe ref
IntPtr
EventHandle
48
{
49
get
50
{
51
if
(
_pNativeOverlapped
==
null
)
52
{
53
return
ref
_eventHandle
;
54
}
55
return
ref
_pNativeOverlapped
->
EventHandle
;
56
}
57
}
58
59
internal
OverlappedData
(
Overlapped
overlapped)
60
{
61
_overlapped
= overlapped;
62
}
63
64
internal
unsafe
NativeOverlapped
*
Pack
(
IOCompletionCallback
iocb,
object
userData)
65
{
66
if
(
_pNativeOverlapped
!=
null
)
67
{
68
throw
new
InvalidOperationException
(
SR
.
InvalidOperation_Overlapped_Pack
);
69
}
70
if
(iocb !=
null
)
71
{
72
ExecutionContext
executionContext =
ExecutionContext
.
Capture
();
73
_callback
= ((executionContext !=
null
&& !executionContext.
IsDefault
) ? ((
object
)
new
_IOCompletionCallback
(iocb, executionContext)) : ((object)iocb));
74
}
75
else
76
{
77
_callback
=
null
;
78
}
79
_userObject
= userData;
80
return
AllocateNativeOverlapped
();
81
}
82
83
internal
unsafe
NativeOverlapped
*
UnsafePack
(
IOCompletionCallback
iocb,
object
userData)
84
{
85
if
(
_pNativeOverlapped
!=
null
)
86
{
87
throw
new
InvalidOperationException
(
SR
.
InvalidOperation_Overlapped_Pack
);
88
}
89
_userObject
= userData;
90
_callback
= iocb;
91
return
AllocateNativeOverlapped
();
92
}
93
94
internal
bool
IsUserObject
(
byte
[]
buffer
)
95
{
96
return
_userObject
==
buffer
;
97
}
98
99
[MethodImpl(
MethodImplOptions
.InternalCall)]
100
private
unsafe
extern
NativeOverlapped
*
AllocateNativeOverlapped
();
101
102
[MethodImpl(
MethodImplOptions
.InternalCall)]
103
internal
unsafe
static
extern
void
FreeNativeOverlapped
(
NativeOverlapped
* nativeOverlappedPtr);
104
105
[MethodImpl(
MethodImplOptions
.InternalCall)]
106
internal
unsafe
static
extern
OverlappedData
GetOverlappedFromNative
(
NativeOverlapped
* nativeOverlappedPtr);
107
108
[MethodImpl(
MethodImplOptions
.InternalCall)]
109
internal
unsafe
static
extern
void
CheckVMForIOPacket
(out
NativeOverlapped
* pNativeOverlapped, out uint errorCode, out uint numBytes);
110
}
System.InvalidOperationException
Definition
InvalidOperationException.cs:9
System.SR.InvalidOperation_Overlapped_Pack
static string InvalidOperation_Overlapped_Pack
Definition
SR.cs:1500
System.SR
Definition
SR.cs:7
System.Threading.ExecutionContext.Capture
static ? ExecutionContext Capture()
Definition
ExecutionContext.cs:44
System.Threading.ExecutionContext.IsDefault
bool IsDefault
Definition
ExecutionContext.cs:25
System.Threading.ExecutionContext
Definition
ExecutionContext.cs:10
System.Threading.OverlappedData._offsetLow
int _offsetLow
Definition
OverlappedData.cs:19
System.Threading.OverlappedData.AllocateNativeOverlapped
unsafe NativeOverlapped * AllocateNativeOverlapped()
System.Threading.OverlappedData.Pack
unsafe NativeOverlapped * Pack(IOCompletionCallback iocb, object userData)
Definition
OverlappedData.cs:64
System.Threading.OverlappedData.IsUserObject
bool IsUserObject(byte[] buffer)
Definition
OverlappedData.cs:94
System.Threading.OverlappedData.FreeNativeOverlapped
static unsafe void FreeNativeOverlapped(NativeOverlapped *nativeOverlappedPtr)
System.Threading.OverlappedData.OffsetLow
unsafe ref int OffsetLow
Definition
OverlappedData.cs:24
System.Threading.OverlappedData._offsetHigh
int _offsetHigh
Definition
OverlappedData.cs:21
System.Threading.OverlappedData._pNativeOverlapped
unsafe readonly NativeOverlapped * _pNativeOverlapped
Definition
OverlappedData.cs:15
System.Threading.OverlappedData.OffsetHigh
unsafe ref int OffsetHigh
Definition
OverlappedData.cs:36
System.Threading.OverlappedData._userObject
object _userObject
Definition
OverlappedData.cs:13
System.Threading.OverlappedData.GetOverlappedFromNative
static unsafe OverlappedData GetOverlappedFromNative(NativeOverlapped *nativeOverlappedPtr)
System.Threading.OverlappedData.OverlappedData
OverlappedData(Overlapped overlapped)
Definition
OverlappedData.cs:59
System.Threading.OverlappedData._eventHandle
IntPtr _eventHandle
Definition
OverlappedData.cs:17
System.Threading.OverlappedData.CheckVMForIOPacket
static unsafe void CheckVMForIOPacket(out NativeOverlapped *pNativeOverlapped, out uint errorCode, out uint numBytes)
System.Threading.OverlappedData._asyncResult
IAsyncResult _asyncResult
Definition
OverlappedData.cs:7
System.Threading.OverlappedData._callback
object _callback
Definition
OverlappedData.cs:9
System.Threading.OverlappedData._overlapped
readonly Overlapped _overlapped
Definition
OverlappedData.cs:11
System.Threading.OverlappedData.UnsafePack
unsafe NativeOverlapped * UnsafePack(IOCompletionCallback iocb, object userData)
Definition
OverlappedData.cs:83
System.Threading.OverlappedData.EventHandle
unsafe ref IntPtr EventHandle
Definition
OverlappedData.cs:48
System.Threading.OverlappedData
Definition
OverlappedData.cs:6
System.Threading.Overlapped
Definition
Overlapped.cs:4
System.Threading._IOCompletionCallback
Definition
_IOCompletionCallback.cs:4
System.IAsyncResult
Definition
IAsyncResult.cs:6
System.Runtime.CompilerServices.MethodImplOptions
MethodImplOptions
Definition
MethodImplOptions.cs:5
System.Runtime.CompilerServices
Definition
NullablePublicOnlyAttribute.cs:3
System.Threading.IOCompletionCallback
unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, NativeOverlapped *pOVERLAP)
System.Threading
Definition
TaskToApm.cs:3
System.ExceptionArgument.buffer
@ buffer
System.IntPtr
Definition
IntPtr.cs:14
System.Threading.NativeOverlapped.EventHandle
IntPtr EventHandle
Definition
NativeOverlapped.cs:13
System.Threading.NativeOverlapped.OffsetHigh
int OffsetHigh
Definition
NativeOverlapped.cs:11
System.Threading.NativeOverlapped.OffsetLow
int OffsetLow
Definition
NativeOverlapped.cs:9
System.Threading.NativeOverlapped
Definition
NativeOverlapped.cs:4
source
System.Private.CoreLib
System.Threading
OverlappedData.cs
Generated by
1.10.0