What is the difference between Timer and Thread?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Phiru
    New Member
    • Apr 2010
    • 3

    #1

    What is the difference between Timer and Thread?

    I used Timer in VB. then, I want to convert a program with VB.net.

    So, I used Thread instead of Timer.

    Then, I am curious what difference they are?

    plz, let me know it.

    Thanks.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    There are three basic timer objects:
    System.Threadin g.Timer;
    System.Timers.T imer;
    System.Windows. Forms.Timer;

    System.Windows. Forms.Timer is probably the one you are familiar with. It runs in the same thread as the message loop (generally the GUI thread) and it pretty basic, but requires the windows message pump to function.


    System.Threadin g.Timer is the most complex. It runs in its own thread everytime it is fired and takes some research to use it correctly (being thread safe, etc etc)

    In the middle ground is System.Timers.T imer, it functions similar to the windows.forms timer in implimentation but does not require the windows message pump(I don't believe). I like to think of it as the same as the windows.forms one, only for console applications.

    Comment

    Working...