Timers

by alski 3. July 2007 11:59

From ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxadvance/html/7091500d-be18-499b-a942-95366ce185e5.htm

Timers are lightweight objects that enable you to specify a delegate to be called at a specified time. A thread in the thread pool performs the wait operation.

Using the Timer class is straightforward. You create a Timer, passing a TimerCallback delegate to the callback method, an object representing state that will be passed to the callback, an initial raise time, and a time representing the period between callback invocations. To cancel a pending timer, call the Timer.Dispose function.

Note

There are two other timer classes. The System.Windows.Forms.Timer class is a control that works with visual designers and is meant to be used in user interface contexts; it raises events on the user interface thread. The System.Timers.Timer class derives from Component, so it can be used with visual designers; it also raises events, but it raises them on a ThreadPool thread. The System.Threading.Timer class makes callbacks on a ThreadPool thread and does not use the event model at all. It also provides a state object to the callback method, which the other timers do not. It is extremely lightweight.

 
So that's nice and clear then.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

RecentComments

Comment RSS