Re: long-running background threads

Discussion in 'ASP .Net' started by David Browne, Jun 7, 2004.

  1. David Browne

    David Browne Guest

    "Erik Sargent" <> wrote in message
    news:...
    > I have a very simple web app for displaying the status of a group of

    doctors (available/not available) which,

    .. . .
    > When I debug, it works fine. When I make a request once per minute, it

    works fine. Each change is logged and I >can pull up Windows explorer and
    watch the log file's timestamp increment each minute. The problem is if
    nothing >happens for several minutes - then it just seems to stop.
    >


    Have faith. Threads don't just stop. And what you're doing should work
    fine.

    Make sure that your Thread Proc has a catch block, and records any exception
    in your log file.

    void PollingThreadProc()
    {
    try
    {
    while (true)
    {
    Thread.Sleep(1000*60);
    //do something
    }

    }
    catch (Exception ex)
    {
    Trace.WriteLine("Polling thread terminating with exception");
    Trace.WriteLine(ex.ToString());
    throw;
    }

    }

    David
     
    David Browne, Jun 7, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bruce barker

    Re: long-running background threads

    bruce barker, Jun 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    402
    bruce barker
    Jun 7, 2004
  2. iksrazal
    Replies:
    1
    Views:
    2,774
    marcus
    Jul 28, 2004
  3. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    708
    Eric Sosman
    Jul 8, 2003
  4. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,220
    Peter Shaggy Haywood
    Sep 20, 2005
  5. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    497
    santosh
    Jul 24, 2007
Loading...

Share This Page