You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System.Threading.Tasks/Task.xml
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2322,6 +2322,9 @@ End Sub
2322
2322
After the specified time delay, the task is completed in the <xref:System.Threading.Tasks.TaskStatus.RanToCompletion> state.
2323
2323
2324
2324
This method depends on the system clock. This means that the time delay will approximately equal the resolution of the system clock if the `millisecondsDelay` argument is less than the resolution of the system clock, which is approximately 15 milliseconds on Windows systems.
2325
+
2326
+
> [!NOTE]
2327
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
2325
2328
2326
2329
2327
2330
@@ -2387,6 +2390,9 @@ End Sub
2387
2390
For usage scenarios and additional examples, see the documentation for the <xref:System.Threading.Tasks.Task.Delay%28System.Int32%29> overload.
2388
2391
2389
2392
This method depends on the system clock. This means that the time delay will approximately equal the resolution of the system clock if the `delay` argument is less than the resolution of the system clock, which is approximately 15 milliseconds on Windows systems.
2393
+
2394
+
> [!NOTE]
2395
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
2390
2396
2391
2397
2392
2398
@@ -2459,6 +2465,9 @@ End Sub
2459
2465
For usage scenarios and additional examples, see the documentation for the <xref:System.Threading.Tasks.Task.Delay%28System.Int32%29> overload.
2460
2466
2461
2467
This method depends on the system clock. This means that the time delay will approximately equal the resolution of the system clock if the `millisecondsDelay` argument is less than the resolution of the system clock, which is approximately 15 milliseconds on Windows systems.
2468
+
2469
+
> [!NOTE]
2470
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
2462
2471
2463
2472
2464
2473
@@ -2528,6 +2537,9 @@ End Sub
2528
2537
For usage scenarios and additional examples, see the documentation for the <xref:System.Threading.Tasks.Task.Delay%28System.Int32%29> overload.
2529
2538
2530
2539
This method depends on the system clock. This means that the time delay will approximately equal the resolution of the system clock if the `delay` argument is less than the resolution of the system clock, which is approximately 15 milliseconds on Windows systems.
2540
+
2541
+
> [!NOTE]
2542
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
Copy file name to clipboardExpand all lines: xml/System.Threading/Timer.xml
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,9 @@ Sub TimerCallback(state As Object)
102
102
103
103
> [!NOTE]
104
104
> As long as you are using a <xref:System.Threading.Timer>, you must keep a reference to it. As with any managed object, a <xref:System.Threading.Timer> is subject to garbage collection when there are no references to it. The fact that a <xref:System.Threading.Timer> is still active does not prevent it from being collected.
105
+
106
+
> [!NOTE]
107
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
105
108
106
109
When a timer is no longer needed, use the <xref:System.Threading.Timer.Dispose%2A> method to free the resources held by the timer. Note that callbacks can occur after the <xref:System.Threading.Timer.Dispose> method overload has been called, because the timer queues callbacks for execution by thread pool threads. You can use the <xref:System.Threading.Timer.Dispose%28System.Threading.WaitHandle%29> method overload to wait until all callbacks have completed.
107
110
@@ -271,6 +274,9 @@ Sub TimerCallback(state As Object)
271
274
If `dueTime` is zero (0), `callback` is invoked immediately. If `dueTime` is <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType>, `callback` is not invoked; the timer is disabled, but can be re-enabled by calling the <xref:System.Threading.Timer.Change%2A> method.
272
275
273
276
Because the <xref:System.Threading.Timer> class has the same resolution as the system clock, which is approximately 15 milliseconds on Windows 7 and Windows 8 systems, the `callback` delegate executes at intervals defined by the resolution of the system clock if `period` is less than the resolution of the system clock. If `period` is zero (0) or <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType> and `dueTime` is not <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType>, `callback` is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <xref:System.Threading.Timer.Change%2A> method.
277
+
278
+
> [!NOTE]
279
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
274
280
275
281
The method specified for `callback` should be reentrant, because it is called on <xref: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.
276
282
@@ -350,6 +356,9 @@ Sub TimerCallback(state As Object)
350
356
If `dueTime` is zero (0), `callback` is invoked immediately. If `dueTime` is <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType>, `callback` is not invoked; the timer is disabled, but can be re-enabled by calling the <xref:System.Threading.Timer.Change%2A> method.
351
357
352
358
Because the <xref:System.Threading.Timer> class has the same resolution as the system clock, which is approximately 15 milliseconds on Windows 7 and Windows 8 systems, the `callback` delegate executes at intervals defined by the resolution of the system clock if `period` is less than the resolution of the system clock. If `period` is zero (0) or <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType> and `dueTime` is not <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType>, `callback` is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <xref:System.Threading.Timer.Change%2A> method.
359
+
360
+
> [!NOTE]
361
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
353
362
354
363
The method specified for `callback` should be reentrant, because it is called on <xref: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.
355
364
@@ -421,6 +430,9 @@ Sub TimerCallback(state As Object)
421
430
If `dueTime` is zero (0), `callback` is invoked immediately. If `dueTime` is negative one (-1) milliseconds, `callback` is not invoked; the timer is disabled, but can be re-enabled by calling the <xref:System.Threading.Timer.Change%2A> method.
422
431
423
432
Because the <xref:System.Threading.Timer> class has the same resolution as the system clock, which is approximately 15 milliseconds on Windows 7 and Windows 8 systems, the `callback` delegate executes at intervals defined by the resolution of the system clock if `period` is less than the resolution of the system clock. If `period` is zero (0) or negative one (-1) milliseconds and `dueTime` is positive, `callback` is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <xref:System.Threading.Timer.Change%2A> method.
433
+
434
+
> [!NOTE]
435
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
424
436
425
437
The method specified for `callback` should be reentrant, because it is called on <xref: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.
426
438
@@ -504,6 +516,9 @@ Sub TimerCallback(state As Object)
504
516
If `dueTime` is zero (0), `callback` is invoked immediately. If `dueTime` is <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType>, `callback` is not invoked; the timer is disabled, but can be re-enabled by calling the <xref:System.Threading.Timer.Change%2A> method.
505
517
506
518
Because the <xref:System.Threading.Timer> class has the same resolution as the system clock, which is approximately 15 milliseconds on Windows 7 and Windows 8 systems, the `callback` delegate executes at intervals defined by the resolution of the system clock if `period` is less than the resolution of the system clock. If `period` is zero (0) or <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType> and `dueTime` is not <xref:System.Threading.Timeout.Infinite?displayProperty=nameWithType>, `callback` is invoked once; the periodic behavior of the timer is disabled, but can be re-enabled using the <xref:System.Threading.Timer.Change%2A> method.
519
+
520
+
> [!NOTE]
521
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
507
522
508
523
The method specified for `callback` should be reentrant, because it is called on <xref: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.
Copy file name to clipboardExpand all lines: xml/System.Timers/Timer.xml
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,9 @@
69
69
70
70
> [!IMPORTANT]
71
71
> The System.Timers.Timer class has the same resolution as the system clock. This means that the <xref:System.Timers.Timer.Elapsed> event will fire at an interval defined by the resolution of the system clock if the <xref:System.Timers.Timer.Interval%2A> property is less than the resolution of the system clock. For more information, see the <xref:System.Timers.Timer.Interval%2A> property.
72
+
73
+
> [!NOTE]
74
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
72
75
73
76
When <xref:System.Timers.Timer.AutoReset%2A> is set to `false`, a <xref:System.Timers.Timer?displayProperty=nameWithType> object raises the <xref:System.Timers.Timer.Elapsed> event only once, after the first <xref:System.Timers.Timer.Interval%2A> has elapsed. To keep raising the <xref:System.Timers.Timer.Elapsed> event regularly at the interval defined by the <xref:System.Timers.Timer.Interval%2A>, set <xref:System.Timers.Timer.AutoReset%2A> to `true`, which is the default value.
74
77
@@ -753,16 +756,14 @@
753
756
<formattype="text/markdown"><![CDATA[
754
757
755
758
## Remarks
756
-
You use the <xref:System.Timers.Timer.Interval%2A> property to determine the frequency at which the <xref:System.Timers.Timer.Elapsed> event is fired. Because the <xref:System.Timers.Timer> class depends on the system clock, it has the same resolution as the system clock. This means that the <xref:System.Timers.Timer.Elapsed> event will fire at an interval defined by the resolution of the system clock if the <xref:System.Timers.Timer.Interval%2A> property is less than the resolution of the system clock. The following example sets the <xref:System.Timers.Timer.Interval%2A> property to 5 milliseconds. When run on a Windows 7 system whose system clock has a resolution of approximately 15 milliseconds, the event fires approximately every 15 milliseconds rather than every 5 milliseconds.
759
+
You use the <xref:System.Timers.Timer.Interval%2A> property to determine the frequency at which the <xref:System.Timers.Timer.Elapsed> event is fired. Because the <xref:System.Timers.Timer> class depends on the system clock, it has the same resolution as the system clock. This means that the <xref:System.Timers.Timer.Elapsed> event will fire at an interval defined by the resolution of the system clock if the <xref:System.Timers.Timer.Interval%2A> property is less than the resolution of the system clock. The following example sets the <xref:System.Timers.Timer.Interval%2A> property to 5 milliseconds. When run on a Windows system whose system clock has a resolution of approximately 15 milliseconds, the event fires approximately every 15 milliseconds rather than every 5 milliseconds.
760
+
761
+
> [!NOTE]
762
+
> The system clock that is used is the same clock used by [GetTickCount](/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount), which is not affected by changes made with [timeBeginPeriod](/windows/win32/api/timeapi/nf-timeapi-timebeginperiod) and [timeEndPeriod](/windows/win32/api/timeapi/nf-timeapi-timeendperiod).
If your app requires greater resolution than that offered by the <xref:System.Timers.Timer> class or the system clock, use the high-resolution multimedia timers; see [How to: Use the High-Resolution Timer](https://msdn.microsoft.com/library/aa964692.aspx).
767
768
768
769
If the interval is set after the <xref:System.Timers.Timer> has started, the count is reset. For example, if you set the interval to 5 seconds and then set the <xref:System.Timers.Timer.Enabled%2A> property to `true`, the count starts at the time <xref:System.Timers.Timer.Enabled%2A> is set. If you reset the interval to 10 seconds when count is 3 seconds, the <xref:System.Timers.Timer.Elapsed> event is raised for the first time 13 seconds after <xref:System.Timers.Timer.Enabled%2A> was set to `true`.
0 commit comments