Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Timer.cs
Go to the documentation of this file.
5
6namespace System.Threading;
7
8[DebuggerDisplay("{DisplayString,nq}")]
11{
13
14 public static long ActiveCount
15 {
16 get
17 {
18 long num = 0L;
21 {
23 {
24 num += timerQueue.ActiveCount;
25 }
26 }
27 return num;
28 }
29 }
30
32
34 {
35 get
36 {
40 {
41 list.AddRange(timerQueue.GetTimersForDebugger());
42 }
43 list.Sort((TimerQueueTimer t1, TimerQueueTimer t2) => t1._dueTime.CompareTo(t2._dueTime));
44 return list;
45 }
46 }
47
48 public Timer(TimerCallback callback, object? state, int dueTime, int period)
50 {
51 }
52
53 internal Timer(TimerCallback callback, object state, int dueTime, int period, bool flowExecutionContext)
54 {
55 if (dueTime < -1)
56 {
58 }
59 if (period < -1)
60 {
62 }
63 TimerSetup(callback, state, (uint)dueTime, (uint)period, flowExecutionContext);
64 }
65
67 {
68 long num = (long)dueTime.TotalMilliseconds;
69 if (num < -1)
70 {
72 }
73 if (num > 4294967294u)
74 {
76 }
77 long num2 = (long)period.TotalMilliseconds;
78 if (num2 < -1)
79 {
81 }
82 if (num2 > 4294967294u)
83 {
85 }
86 TimerSetup(callback, state, (uint)num, (uint)num2);
87 }
88
89 [CLSCompliant(false)]
90 public Timer(TimerCallback callback, object? state, uint dueTime, uint period)
91 {
92 TimerSetup(callback, state, dueTime, period);
93 }
94
95 public Timer(TimerCallback callback, object? state, long dueTime, long period)
96 {
97 if (dueTime < -1)
98 {
100 }
101 if (period < -1)
102 {
104 }
105 if (dueTime > 4294967294u)
106 {
108 }
109 if (period > 4294967294u)
110 {
112 }
113 TimerSetup(callback, state, (uint)dueTime, (uint)period);
114 }
115
116 public Timer(TimerCallback callback)
117 {
118 TimerSetup(callback, this, uint.MaxValue, uint.MaxValue);
119 }
120
121 [MemberNotNull("_timer")]
122 private void TimerSetup(TimerCallback callback, object state, uint dueTime, uint period, bool flowExecutionContext = true)
123 {
124 if (callback == null)
125 {
126 throw new ArgumentNullException("callback");
127 }
129 }
130
131 public bool Change(int dueTime, int period)
132 {
133 if (dueTime < -1)
134 {
136 }
137 if (period < -1)
138 {
140 }
141 return _timer._timer.Change((uint)dueTime, (uint)period);
142 }
143
145 {
146 return Change((long)dueTime.TotalMilliseconds, (long)period.TotalMilliseconds);
147 }
148
149 [CLSCompliant(false)]
150 public bool Change(uint dueTime, uint period)
151 {
153 }
154
155 public bool Change(long dueTime, long period)
156 {
157 if (dueTime < -1)
158 {
160 }
161 if (period < -1)
162 {
164 }
165 if (dueTime > 4294967294u)
166 {
168 }
169 if (period > 4294967294u)
170 {
172 }
173 return _timer._timer.Change((uint)dueTime, (uint)period);
174 }
175
177 {
178 if (notifyObject == null)
179 {
180 throw new ArgumentNullException("notifyObject");
181 }
182 return _timer.Close(notifyObject);
183 }
184
185 public void Dispose()
186 {
187 _timer.Close();
188 }
189
191 {
192 return _timer.CloseAsync();
193 }
194}
static string ArgumentOutOfRange_PeriodTooLarge
Definition SR.cs:1092
static string ArgumentOutOfRange_NeedNonNegOrNegative1
Definition SR.cs:1072
static string ArgumentOutOfRange_TimeoutTooLarge
Definition SR.cs:1112
Definition SR.cs:7
readonly TimerQueueTimer _timer
Definition TimerHolder.cs:7
bool Change(uint dueTime, uint period)
static TimerQueue[] Instances
Definition TimerQueue.cs:57
Timer(TimerCallback callback, object? state, int dueTime, int period)
Definition Timer.cs:48
Timer(TimerCallback callback)
Definition Timer.cs:116
TimerHolder _timer
Definition Timer.cs:12
bool Change(TimeSpan dueTime, TimeSpan period)
Definition Timer.cs:144
bool Change(uint dueTime, uint period)
Definition Timer.cs:150
ValueTask DisposeAsync()
Definition Timer.cs:190
bool Change(long dueTime, long period)
Definition Timer.cs:155
static IEnumerable< TimerQueueTimer > AllTimers
Definition Timer.cs:34
Timer(TimerCallback callback, object? state, uint dueTime, uint period)
Definition Timer.cs:90
bool Dispose(WaitHandle notifyObject)
Definition Timer.cs:176
void TimerSetup(TimerCallback callback, object state, uint dueTime, uint period, bool flowExecutionContext=true)
Definition Timer.cs:122
static long ActiveCount
Definition Timer.cs:15
Timer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
Definition Timer.cs:66
Timer(TimerCallback callback, object? state, long dueTime, long period)
Definition Timer.cs:95
Timer(TimerCallback callback, object state, int dueTime, int period, bool flowExecutionContext)
Definition Timer.cs:53
bool Change(int dueTime, int period)
Definition Timer.cs:131
delegate void TimerCallback(object? state)