Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Monitor.cs
Go to the documentation of this file.
5
6namespace System.Threading;
7
8public static class Monitor
9{
11
12 [MethodImpl(MethodImplOptions.InternalCall)]
13 public static extern void Enter(object obj);
14
15 public static void Enter(object obj, ref bool lockTaken)
16 {
17 if (lockTaken)
18 {
20 }
21 ReliableEnter(obj, ref lockTaken);
22 }
23
24 [DoesNotReturn]
25 private static void ThrowLockTakenException()
26 {
27 throw new ArgumentException(SR.Argument_MustBeFalse, "lockTaken");
28 }
29
30 [MethodImpl(MethodImplOptions.InternalCall)]
31 private static extern void ReliableEnter(object obj, ref bool lockTaken);
32
33 [MethodImpl(MethodImplOptions.InternalCall)]
34 public static extern void Exit(object obj);
35
36 public static bool TryEnter(object obj)
37 {
38 bool lockTaken = false;
39 TryEnter(obj, 0, ref lockTaken);
40 return lockTaken;
41 }
42
43 public static void TryEnter(object obj, ref bool lockTaken)
44 {
45 if (lockTaken)
46 {
48 }
49 ReliableEnterTimeout(obj, 0, ref lockTaken);
50 }
51
52 public static bool TryEnter(object obj, int millisecondsTimeout)
53 {
54 bool lockTaken = false;
55 TryEnter(obj, millisecondsTimeout, ref lockTaken);
56 return lockTaken;
57 }
58
59 public static void TryEnter(object obj, int millisecondsTimeout, ref bool lockTaken)
60 {
61 if (lockTaken)
62 {
64 }
66 }
67
68 [MethodImpl(MethodImplOptions.InternalCall)]
69 private static extern void ReliableEnterTimeout(object obj, int timeout, ref bool lockTaken);
70
71 public static bool IsEntered(object obj)
72 {
73 if (obj == null)
74 {
75 throw new ArgumentNullException("obj");
76 }
77 return IsEnteredNative(obj);
78 }
79
80 [MethodImpl(MethodImplOptions.InternalCall)]
81 private static extern bool IsEnteredNative(object obj);
82
83 [MethodImpl(MethodImplOptions.InternalCall)]
84 private static extern bool ObjWait(int millisecondsTimeout, object obj);
85
86 [UnsupportedOSPlatform("browser")]
87 public static bool Wait(object obj, int millisecondsTimeout)
88 {
89 if (obj == null)
90 {
91 throw new ArgumentNullException("obj");
92 }
93 if (millisecondsTimeout < -1)
94 {
96 }
98 }
99
100 [MethodImpl(MethodImplOptions.InternalCall)]
101 private static extern void ObjPulse(object obj);
102
103 public static void Pulse(object obj)
104 {
105 if (obj == null)
106 {
107 throw new ArgumentNullException("obj");
108 }
109 ObjPulse(obj);
110 }
111
112 [MethodImpl(MethodImplOptions.InternalCall)]
113 private static extern void ObjPulseAll(object obj);
114
115 public static void PulseAll(object obj)
116 {
117 if (obj == null)
118 {
119 throw new ArgumentNullException("obj");
120 }
122 }
123
124 [DllImport("QCall", CharSet = CharSet.Unicode)]
125 private static extern long GetLockContentionCount();
126
127 public static bool TryEnter(object obj, TimeSpan timeout)
128 {
130 }
131
132 public static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken)
133 {
135 }
136
137 [UnsupportedOSPlatform("browser")]
138 public static bool Wait(object obj, TimeSpan timeout)
139 {
141 }
142
143 [UnsupportedOSPlatform("browser")]
144 public static bool Wait(object obj)
145 {
146 return Wait(obj, -1);
147 }
148
149 [UnsupportedOSPlatform("browser")]
150 public static bool Wait(object obj, int millisecondsTimeout, bool exitContext)
151 {
153 }
154
155 [UnsupportedOSPlatform("browser")]
156 public static bool Wait(object obj, TimeSpan timeout, bool exitContext)
157 {
159 }
160}
static string ArgumentOutOfRange_NeedNonNegOrNegative1
Definition SR.cs:1072
static string Argument_MustBeFalse
Definition SR.cs:772
Definition SR.cs:7
static bool Wait(object obj, int millisecondsTimeout, bool exitContext)
Definition Monitor.cs:150
static void Exit(object obj)
static bool Wait(object obj, TimeSpan timeout)
Definition Monitor.cs:138
static void PulseAll(object obj)
Definition Monitor.cs:115
static bool TryEnter(object obj, TimeSpan timeout)
Definition Monitor.cs:127
static bool IsEntered(object obj)
Definition Monitor.cs:71
static void TryEnter(object obj, TimeSpan timeout, ref bool lockTaken)
Definition Monitor.cs:132
static void Enter(object obj, ref bool lockTaken)
Definition Monitor.cs:15
static void ObjPulse(object obj)
static bool TryEnter(object obj, int millisecondsTimeout)
Definition Monitor.cs:52
static void TryEnter(object obj, int millisecondsTimeout, ref bool lockTaken)
Definition Monitor.cs:59
static void ReliableEnter(object obj, ref bool lockTaken)
static void ObjPulseAll(object obj)
static bool Wait(object obj, int millisecondsTimeout)
Definition Monitor.cs:87
static bool TryEnter(object obj)
Definition Monitor.cs:36
static long GetLockContentionCount()
static bool Wait(object obj)
Definition Monitor.cs:144
static void TryEnter(object obj, ref bool lockTaken)
Definition Monitor.cs:43
static bool IsEnteredNative(object obj)
static bool ObjWait(int millisecondsTimeout, object obj)
static void ReliableEnterTimeout(object obj, int timeout, ref bool lockTaken)
static bool Wait(object obj, TimeSpan timeout, bool exitContext)
Definition Monitor.cs:156
static void ThrowLockTakenException()
Definition Monitor.cs:25
static void Enter(object obj)
static long LockContentionCount
Definition Monitor.cs:10
static void Pulse(object obj)
Definition Monitor.cs:103
static int ToTimeoutMilliseconds(TimeSpan timeout)
Definition WaitHandle.cs:93