Re: when is threading better than a timer?

From: Bob (
Date: 09/29/04

Date: Wed, 29 Sep 2004 10:36:24 -0400

It's milliseconds. Looks like I was using the right Timer class, too
(System.Windows.Forms.Timer), since I wanted it to mesh with and respect the
UI. Very good links, thank you.


"Jay B. Harlow [MVP - Outlook]" <> wrote in message
> Bob,
> If you have a long running process (half a minute or longer) I would
> recommend a separate thread. By long running, I mean if it takes long
> that the user will start to think your app stopped responding (hung).
> If the database check takes fractions of a second I would leave it as a
> Windows Timer.
> Remember there are three distinct timer objects in .NET. One of the other
> two may be more appropriate, the following articles in MSDN Magazine
> the difference between the three timer objects in .NET & when to use each.
> The above articles also discusses if & how each timer interacts with
> threading.
> Hope this helps
> Jay
> Hope this helps
> Jay
> "Bob" <> wrote in message
> news:ei6CKhipEHA.3520@TK2MSFTNGP11.phx.gbl...
> > Okay, I've done this for years but now I'm going to question it just
> > because
> > this idea has been at the back of my head since I started using
> >
> > My WinForms app queries a database every 60 seconds. I set up a
> > class that's instantiated when the app starts, and that starts a timer.
> > question is, would it be better to run this checking process on a
> > thread and have it use its own DB connection? If there isn't a clear yes
> > or
> > no, what circumstances affect the answer?
> >
> > TIA,
> > Bob
> >
> >

Relevant Pages

  • Re: Lahman, how ya doing?
    ... >> I'd started with a Timer class that keeps the total time separately in ... double event job I wound up rewriting a few member functions in the ... derived class identically except for different pointer types. ...
  • POSIX based Timer class, occasional crash
    ... I've got a Timer class and a TimerClient base class. ... number of times to fire the timer, timer attributes, a pointer to the ... client, and a pointer to a client specific "payload" that gets ...
  • Re: Timers
    ... so do i set the interval to x amount of milliseconds based on milliseconds ... It seems to me your best bet is to determine the exact time in the future you want the timer to execute, calculate the difference between that exact time and "now", and then use the result of that as the timer delay for a one-shot timer. ... It will fire when the elapsed time has expired. ... Each timer class has a slightly different syntax for configuring it as a one-shot timer, so without knowing what class you're using, it's not possible to say for sure what you would want to do. ...
  • Re: POSIX based Timer class, occasional crash
    ... > I've got a Timer class and a TimerClient base class. ... > Every once in a while an application that is using the timer crashes, ...
  • Re: thread differences from button_Click and timer_Elapsed
    ... it would be the timer that uses a different thread (it ... but rather get one from the thread pool). ... does that depends on which timer class you're using. ... compare them between the two executions ...