1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
|
<?xml version="1.0" encoding="utf-8"?>
<Type Name="Timer" FullName="System.Threading.Timer" FullNameSP="System_Threading_Timer" Maintainer="ecma">
<TypeSignature Language="ILASM" Value=".class public sealed Timer extends System.MarshalByRefObject implements System.IDisposable" />
<TypeSignature Language="C#" Value="public sealed class Timer : MarshalByRefObject, IDisposable" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit Timer extends System.MarshalByRefObject implements class System.IDisposable" />
<MemberOfLibrary>BCL</MemberOfLibrary>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
<Base>
<BaseTypeName>System.MarshalByRefObject</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.IDisposable</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<example>
<para>The following example demonstrates the features of the <see cref="T:System.Threading.Timer" />
class.</para>
<code lang="C#">using System;
using System.Threading;
class TimerExampleState {
public int counter = 0;
public Timer tmr;
}
class App {
public static void Main() {
TimerExampleState s = new TimerExampleState();
// Create the delegate that invokes methods for the timer.
TimerCallback timerDelegate = new TimerCallback(CheckStatus);
// Create a timer that waits one second, then invokes every second.
Timer timer = new Timer(timerDelegate, s, 1000, 1000);
// Keep a handle to the timer, so it can be disposed.
s.tmr = timer;
// The main thread does nothing until the timer is disposed.
while (s.tmr != null)
Thread.Sleep(0);
Console.WriteLine("Timer example done.");
}
// The following method is called by the timer's delegate.
static void CheckStatus(Object state) {
TimerExampleState s = (TimerExampleState) state;
s.counter++;
Console.WriteLine("{0} Checking Status {1}.",DateTime.Now.TimeOfDay, s.counter);
if (s.counter == 5) {
// Shorten the period. Wait 10 seconds to restart the timer.
(s.tmr).Change(10000,100);
Console.WriteLine("changed...");
}
if (s.counter == 10) {
Console.WriteLine("disposing of timer...");
s.tmr.Dispose();
s.tmr = null;
}
}
}
</code>
<para>An example of some output is</para>
<c>
<para>10:51:40.5809015 Checking Status 1.</para>
<para>10:51:41.5823515 Checking Status 2.</para>
<para>10:51:42.5838015 Checking Status 3.</para>
<para>10:51:43.5852515 Checking Status 4.</para>
<para>10:51:44.5867015 Checking Status 5.</para>
<para>changed...</para>
<para>10:51:54.5911870 Checking Status 6.</para>
<para>10:51:54.6913320 Checking Status 7.</para>
<para>10:51:54.7914770 Checking Status 8.</para>
<para>10:51:54.8916220 Checking Status 9.</para>
<para>10:51:54.9917670 Checking Status 10.</para>
<para>disposing of timer...</para>
<para>Timer example done.</para>
</c>
<para>The exact timings returned by this example will vary.</para>
</example>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Use a <see cref="T:System.Threading.TimerCallback" /> delegate to specify the method you want the <see cref="T:System.Threading.Timer" /> to execute. The timer delegate is specified when the timer is constructed, and cannot be changed. The method does not execute on the thread that created the timer; it executes on a <see cref="T:System.Threading.ThreadPool" /> thread supplied by the system.</para>
<para>When you create a timer, you can specify an amount of time to wait before the first execution of the method (due time), and an amount of time to wait between subsequent executions (period). You can change these values, or disable the timer, using the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<block subset="none" type="note">
<para>As long as you are using a <see cref="T:System.Threading.Timer" />, you must keep a reference to it. As with any managed object, a <see cref="T:System.Threading.Timer" /> is subject to garbage collection when there are no references to it. The fact that a <see cref="T:System.Threading.Timer" /> is still active does not prevent it from being collected.</para>
</block>
<para>When a timer is no longer needed, use the <see cref="Overload:System.Threading.Timer.Dispose" /> method to free the resources held by the timer. Note that callbacks can occur after the <see cref="M:System.Threading.Timer.Dispose" /> method overload has been called, because the timer queues callbacks for execution by thread pool threads. You can use the <see cref="M:System.Threading.Timer.Dispose(System.Threading.WaitHandle)" /> method overload to wait until all callbacks have completed. </para>
<para>The callback method executed by the timer should be reentrant, because it is called on <see cref="T:System.Threading.ThreadPool" /> threads. The callback can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the callback, or if all thread pool threads are in use and the callback is queued multiple times.</para>
<block subset="none" type="note">
<para>
<see cref="T:System.Threading.Timer" /> is a simple, lightweight timer that uses callback methods and is served by thread pool threads. It is not recommended for use with Windows Forms, because its callbacks do not occur on the user interface thread. <see cref="T:System.Windows.Forms.Timer" /> is a better choice for use with Windows Forms. For server-based timer functionality, you might consider using <see cref="T:System.Timers.Timer" />, which raises events and has additional features.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Provides a mechanism for executing a method at specified intervals. This class cannot be inherited.</para>
</summary>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Timer (System.Threading.TimerCallback callback);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Threading.TimerCallback callback) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="callback" Type="System.Threading.TimerCallback" />
</Parameters>
<Docs>
<since version=".NET 2.0" />
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Call this constructor when you want to use the <see cref="T:System.Threading.Timer" /> object itself as the state object. After creating the timer, use the <see cref="Overload:System.Threading.Timer.Change" /> method to set the interval and due time.</para>
<para>This constructor specifies an infinite due time before the first callback and an infinite interval between callbacks, in order to prevent the first callback from occurring before the <see cref="T:System.Threading.Timer" /> object is assigned to the state object. </para>
<para>The method specified for <paramref name="callback" /> should be reentrant, because it is called on <see cref="T:System.Threading.ThreadPool" /> threads. The method can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the method, or if all thread pool threads are in use and the method is queued multiple times.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.Threading.Timer" /> class with an infinite period and an infinite due time, using the newly created <see cref="T:System.Threading.Timer" /> object as the state object. </para>
</summary>
<param name="callback">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed.</param>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor(class System.Threading.TimerCallback callback, object state, int32 dueTime, int32 period)" />
<MemberSignature Language="C#" Value="public Timer (System.Threading.TimerCallback callback, object state, int dueTime, int period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Threading.TimerCallback callback, object state, int32 dueTime, int32 period) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue />
<Parameters>
<Parameter Name="callback" Type="System.Threading.TimerCallback" />
<Parameter Name="state" Type="System.Object" />
<Parameter Name="dueTime" Type="System.Int32" />
<Parameter Name="period" Type="System.Int32" />
</Parameters>
<Docs>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="dueTime" /> or <paramref name="period" /> is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" />. </exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="callback" /> is a <see langword="null" /> reference.</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The delegate specified by the <paramref name="callback" /> parameter is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the <paramref name="period" /> time interval elapses.</para>
<para>[Visual Basic]</para>
<block subset="none" type="note">
<para>Visual Basic users can omit the <see cref="T:System.Threading.TimerCallback" /> constructor, and simply use the AddressOf operator when specifying the callback method. Visual Basic automatically calls the correct delegate constructor.</para>
</block>
<para>If <paramref name="dueTime" /> is zero (0), <paramref name="callback" /> is invoked immediately. If <paramref name="dueTime" /> is <see cref="F:System.Threading.Timeout.Infinite" />, <paramref name="callback" /> is not invoked; the timer is disabled, but can be re-enabled by calling the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>If <paramref name="period" /> is zero (0) or <see cref="F:System.Threading.Timeout.Infinite" /> and <paramref name="dueTime" /> is not <see cref="F:System.Threading.Timeout.Infinite" />, <paramref name="callback" /> is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>The method specified for <paramref name="callback" /> should be reentrant, because it is called on <see cref="T:System.Threading.ThreadPool" /> threads. The method can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the method, or if all thread pool threads are in use and the method is queued multiple times.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the Timer class, using a 32-bit signed integer to specify the time interval.</para>
</summary>
<param name="callback">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
<param name="state">
<attribution license="cc4" from="Microsoft" modified="false" />An object containing information to be used by the callback method, or null. </param>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />The amount of time to delay before <paramref name="callback" /> is invoked, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of <paramref name="callback" />, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Timer (System.Threading.TimerCallback callback, object state, long dueTime, long period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Threading.TimerCallback callback, object state, int64 dueTime, int64 period) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="callback" Type="System.Threading.TimerCallback" />
<Parameter Name="state" Type="System.Object" />
<Parameter Name="dueTime" Type="System.Int64" />
<Parameter Name="period" Type="System.Int64" />
</Parameters>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The delegate specified by the <paramref name="callback" /> parameter is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the <paramref name="period" /> time interval elapses.</para>
<para>[Visual Basic]</para>
<block subset="none" type="note">
<para>Visual Basic users can omit the <see cref="T:System.Threading.TimerCallback" /> constructor, and simply use the AddressOf operator when specifying the callback method. Visual Basic automatically calls the correct delegate constructor.</para>
</block>
<para>If <paramref name="dueTime" /> is zero (0), <paramref name="callback" /> is invoked immediately. If <paramref name="dueTime" /> is <see cref="F:System.Threading.Timeout.Infinite" />, <paramref name="callback" /> is not invoked; the timer is disabled, but can be re-enabled by calling the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>If <paramref name="period" /> is zero (0) or <see cref="F:System.Threading.Timeout.Infinite" /> and <paramref name="dueTime" /> is not <see cref="F:System.Threading.Timeout.Infinite" />, <paramref name="callback" /> is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>The method specified for <paramref name="callback" /> should be reentrant, because it is called on <see cref="T:System.Threading.ThreadPool" /> threads. The method can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the method, or if all thread pool threads are in use and the method is queued multiple times.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the Timer class, using 64-bit signed integers to measure time intervals.</para>
</summary>
<param name="callback">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
<param name="state">
<attribution license="cc4" from="Microsoft" modified="false" />An object containing information to be used by the callback method, or null. </param>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />The amount of time to delay before <paramref name="callback" /> is invoked, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of <paramref name="callback" />, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="ILASM" Value="public rtspecialname specialname instance void .ctor(class System.Threading.TimerCallback callback, object state, valuetype System.TimeSpan dueTime, valuetype System.TimeSpan period)" />
<MemberSignature Language="C#" Value="public Timer (System.Threading.TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Threading.TimerCallback callback, object state, valuetype System.TimeSpan dueTime, valuetype System.TimeSpan period) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue />
<Parameters>
<Parameter Name="callback" Type="System.Threading.TimerCallback" />
<Parameter Name="state" Type="System.Object" />
<Parameter Name="dueTime" Type="System.TimeSpan" />
<Parameter Name="period" Type="System.TimeSpan" />
</Parameters>
<Docs>
<exception cref="T:System.ArgumentOutOfRangeException">The number of milliseconds in the value of <paramref name="dueTime" /> or <paramref name="period" /> is negative and not equal to <see cref="F:System.Threading.Timeout.Infinite" />, or is greater than <see cref="F:System.Int32.MaxValue" />.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="callback" /> is a <see langword="null" /> reference.</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The delegate specified by the <paramref name="callback" /> parameter is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the <paramref name="period" /> time interval elapses.</para>
<para>[Visual Basic]</para>
<block subset="none" type="note">
<para>Visual Basic users can omit the <see cref="T:System.Threading.TimerCallback" /> constructor, and simply use the AddressOf operator when specifying the callback method. Visual Basic automatically calls the correct delegate constructor.</para>
</block>
<para>If <paramref name="dueTime" /> is zero (0), <paramref name="callback" /> is invoked immediately. If <paramref name="dueTime" /> is negative one (-1) milliseconds, <paramref name="callback" /> is not invoked; the timer is disabled, but can be re-enabled by calling the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>If <paramref name="period" /> is zero (0) or negative one (-1) milliseconds and <paramref name="dueTime" /> is positive, <paramref name="callback" /> is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>The method specified for <paramref name="callback" /> should be reentrant, because it is called on <see cref="T:System.Threading.ThreadPool" /> threads. The method can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the method, or if all thread pool threads are in use and the method is queued multiple times.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the Timer class, using <see cref="T:System.TimeSpan" /> values to measure time intervals.</para>
</summary>
<param name="callback">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
<param name="state">
<attribution license="cc4" from="Microsoft" modified="false" />An object containing information to be used by the callback method, or null. </param>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.TimeSpan" /> representing the amount of time to delay before the <paramref name="callback" /> parameter invokes its methods. Specify negative one (-1) milliseconds to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of the methods referenced by <paramref name="callback" />. Specify negative one (-1) milliseconds to disable periodic signaling. </param>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Timer (System.Threading.TimerCallback callback, object state, uint dueTime, uint period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Threading.TimerCallback callback, object state, unsigned int32 dueTime, unsigned int32 period) cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.CLSCompliant(false)</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="callback" Type="System.Threading.TimerCallback" />
<Parameter Name="state" Type="System.Object" />
<Parameter Name="dueTime" Type="System.UInt32" />
<Parameter Name="period" Type="System.UInt32" />
</Parameters>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The delegate specified by the <paramref name="callback" /> parameter is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the <paramref name="period" /> time interval elapses.</para>
<para>[Visual Basic]</para>
<block subset="none" type="note">
<para>Visual Basic users can omit the <see cref="T:System.Threading.TimerCallback" /> constructor, and simply use the AddressOf operator when specifying the callback method. Visual Basic automatically calls the correct delegate constructor.</para>
</block>
<para>If <paramref name="dueTime" /> is zero (0), <paramref name="callback" /> is invoked immediately. If <paramref name="dueTime" /> is <see cref="F:System.Threading.Timeout.Infinite" />, <paramref name="callback" /> is not invoked; the timer is disabled, but can be re-enabled by calling the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>If <paramref name="period" /> is zero (0) or <see cref="F:System.Threading.Timeout.Infinite" /> and <paramref name="dueTime" /> is not <see cref="F:System.Threading.Timeout.Infinite" />, <paramref name="callback" /> is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> method.</para>
<para>The method specified for <paramref name="callback" /> should be reentrant, because it is called on <see cref="T:System.Threading.ThreadPool" /> threads. The method can be executed simultaneously on two thread pool threads if the timer interval is less than the time required to execute the method, or if all thread pool threads are in use and the method is queued multiple times.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the Timer class, using 32-bit unsigned integers to measure time intervals.</para>
</summary>
<param name="callback">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Threading.TimerCallback" /> delegate representing a method to be executed. </param>
<param name="state">
<attribution license="cc4" from="Microsoft" modified="false" />An object containing information to be used by the callback method, or null. </param>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />The amount of time to delay before <paramref name="callback" /> is invoked, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from starting. Specify zero (0) to start the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of <paramref name="callback" />, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
</Docs>
</Member>
<Member MemberName="Change">
<MemberSignature Language="ILASM" Value=".method public hidebysig instance bool Change(int32 dueTime, int32 period)" />
<MemberSignature Language="C#" Value="public bool Change (int dueTime, int period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Change(int32 dueTime, int32 period) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dueTime" Type="System.Int32" />
<Parameter Name="period" Type="System.Int32" />
</Parameters>
<Docs>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="dueTime" /> or <paramref name="period" /> is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> .</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The callback method is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the time interval specified by <paramref name="period" /> elapses.</para>
<para>If <paramref name="dueTime" /> is zero (0), the callback method is invoked immediately. If <paramref name="dueTime" /> is <see cref="F:System.Threading.Timeout.Infinite" />, the callback method is never invoked; the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a positive value for <paramref name="dueTime" />.</para>
<para>If <paramref name="period" /> is zero (0) or <see cref="F:System.Threading.Timeout.Infinite" />, and <paramref name="dueTime" /> is not Infinite, the callback method is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a positive value for <paramref name="period" />.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>true if the timer was successfully updated; otherwise, false.</para>
</returns>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />The amount of time to delay before the invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="Change">
<MemberSignature Language="C#" Value="public bool Change (long dueTime, long period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Change(int64 dueTime, int64 period) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dueTime" Type="System.Int64" />
<Parameter Name="period" Type="System.Int64" />
</Parameters>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The callback method is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the time interval specified by <paramref name="period" /> elapses.</para>
<para>If <paramref name="dueTime" /> is zero (0), the callback method is invoked immediately. If <paramref name="dueTime" /> is <see cref="F:System.Threading.Timeout.Infinite" />, the callback method is never invoked; the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a positive value for <paramref name="dueTime" />.</para>
<para>If <paramref name="period" /> is zero (0) or <see cref="F:System.Threading.Timeout.Infinite" />, and <paramref name="dueTime" /> is not Infinite, the callback method is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a positive value for <paramref name="period" />.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Changes the start time and the interval between method invocations for a timer, using 64-bit signed integers to measure time intervals.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>true if the timer was successfully updated; otherwise, false.</para>
</returns>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />The amount of time to delay before the invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
</Docs>
</Member>
<Member MemberName="Change">
<MemberSignature Language="ILASM" Value=".method public hidebysig instance bool Change(valuetype System.TimeSpan dueTime, valuetype System.TimeSpan period)" />
<MemberSignature Language="C#" Value="public bool Change (TimeSpan dueTime, TimeSpan period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Change(valuetype System.TimeSpan dueTime, valuetype System.TimeSpan period) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dueTime" Type="System.TimeSpan" />
<Parameter Name="period" Type="System.TimeSpan" />
</Parameters>
<Docs>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="dueTime" /> or <paramref name="period" /> is negative and is not equal to <see cref="F:System.Threading.Timeout.Infinite" /> .</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The callback method is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the time interval specified by <paramref name="period" /> elapses.</para>
<para>If <paramref name="dueTime" /> is zero (0), the callback method is invoked immediately. If <paramref name="dueTime" /> is negative one (-1) milliseconds, the callback method is never invoked; the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a positive value for <paramref name="dueTime" />.</para>
<para>If <paramref name="period" /> is zero (0) or negative one (-1) milliseconds, and <paramref name="dueTime" /> is positive, the callback method is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a value greater than zero for <paramref name="period" />.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Changes the start time and the interval between method invocations for a timer, using <see cref="T:System.TimeSpan" /> values to measure time intervals.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>true if the timer was successfully updated; otherwise, false.</para>
</returns>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.TimeSpan" /> representing the amount of time to delay before invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed. Specify negative one (-1) milliseconds to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed. Specify negative one (-1) milliseconds to disable periodic signaling. </param>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="Change">
<MemberSignature Language="C#" Value="public bool Change (uint dueTime, uint period);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Change(unsigned int32 dueTime, unsigned int32 period) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.CLSCompliant(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dueTime" Type="System.UInt32" />
<Parameter Name="period" Type="System.UInt32" />
</Parameters>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The callback method is invoked once after <paramref name="dueTime" /> elapses, and thereafter each time the time interval specified by <paramref name="period" /> elapses.</para>
<para>If <paramref name="dueTime" /> is zero (0), the callback method is invoked immediately. If <paramref name="dueTime" /> is <see cref="F:System.Threading.Timeout.Infinite" />, the callback method is never invoked; the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a positive value for <paramref name="dueTime" />.</para>
<para>If <paramref name="period" /> is zero (0) or <see cref="F:System.Threading.Timeout.Infinite" />, and <paramref name="dueTime" /> is not Infinite, the callback method is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled by calling <see cref="M:System.Threading.Timer.Change(System.Int32,System.Int32)" /> and specifying a positive value for <paramref name="period" />.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Changes the start time and the interval between method invocations for a timer, using 32-bit unsigned integers to measure time intervals.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>true if the timer was successfully updated; otherwise, false.</para>
</returns>
<param name="dueTime">
<attribution license="cc4" from="Microsoft" modified="false" />The amount of time to delay before the invoking the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to prevent the timer from restarting. Specify zero (0) to restart the timer immediately. </param>
<param name="period">
<attribution license="cc4" from="Microsoft" modified="false" />The time interval between invocations of the callback method specified when the <see cref="T:System.Threading.Timer" /> was constructed, in milliseconds. Specify <see cref="F:System.Threading.Timeout.Infinite" /> to disable periodic signaling. </param>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="ILASM" Value=".method public final hidebysig virtual void Dispose()" />
<MemberSignature Language="C#" Value="public void Dispose ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Calling Dispose allows the resources used by the <see cref="T:System.Threading.Timer" /> to be reallocated for other purposes. For more information about Dispose, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">[<topic://cpconCleaningUpUnmanagedResources>]</a></format>.</para>
<block subset="none" type="note">
<para>Callbacks can occur after the <see cref="M:System.Threading.Timer.Dispose" /> method overload has been called, because the timer queues callbacks for execution by thread pool threads. You can use the <see cref="M:System.Threading.Timer.Dispose(System.Threading.WaitHandle)" /> method overload to wait until all callbacks have completed.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Releases all resources used by the current instance of <see cref="T:System.Threading.Timer" />.</para>
</summary>
</Docs>
<Excluded>0</Excluded>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="ILASM" Value=".method public hidebysig instance bool Dispose(class System.Threading.WaitHandle notifyObject)" />
<MemberSignature Language="C#" Value="public bool Dispose (System.Threading.WaitHandle notifyObject);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Dispose(class System.Threading.WaitHandle notifyObject) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="notifyObject" Type="System.Threading.WaitHandle" />
</Parameters>
<Docs>
<exception cref="T:System.ArgumentNullException">
<paramref name="notifyObject" /> is <see langword="null" />.</exception>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Calling Dispose allows the resources used by the <see cref="T:System.Threading.Timer" /> to be reallocated for other purposes. For more information about Dispose, see <format type="text/html"><a href="A17B0066-71C2-4BA4-9822-8E19332FC213">[<topic://cpconCleaningUpUnmanagedResources>]</a></format>.</para>
<para>When this method completes, it signals the <see cref="T:System.Threading.WaitHandle" /> specified by the <paramref name="notifyObject" /> parameter. Use this overload of the <see cref="Overload:System.Threading.Timer.Dispose" /> method if you want to be able to block until you are certain that the timer has been disposed. The timer is not disposed until all currently queued callbacks have completed.</para>
<block subset="none" type="note">
<para>If the callback uses the <see cref="Overload:System.Threading.Timer.Change" /> method to set the <paramref name="dueTime" /> parameter to zero, a race condition can occur when the <see cref="M:System.Threading.Timer.Dispose(System.Threading.WaitHandle)" /> method overload is called: If the timer queues a new callback before the <see cref="M:System.Threading.Timer.Dispose(System.Threading.WaitHandle)" /> method overload detects that there are no callbacks queued, <see cref="M:System.Threading.Timer.Dispose(System.Threading.WaitHandle)" /> continues to block; otherwise, the timer is disposed while the new callback is being queued, and an <see cref="T:System.ObjectDisposedException" /> is thrown when the new callback calls the <see cref="Overload:System.Threading.Timer.Change" /> method.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Releases all resources used by the current instance of <see cref="T:System.Threading.Timer" /> and signals when the timer has been disposed of.</para>
</summary>
<returns>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>true if the function succeeds; otherwise, false.</para>
</returns>
<param name="notifyObject">
<attribution license="cc4" from="Microsoft" modified="false" />The <see cref="T:System.Threading.WaitHandle" /> to be signaled when the Timer has been disposed of. </param>
</Docs>
<Excluded>0</Excluded>
</Member>
</Members>
<TypeExcluded>0</TypeExcluded>
</Type>
|