locked
Timer Ticks Twice RRS feed

  • Question

  • Hi All

    I am experiencing a small problem (challenge). I have a VB.net (2003) windows service that fires off a routine every 2 minutes. In fact, it executes an external program, so it doesn't really do much. Everything is great until I try to add threading to the process, either by way of the

    Imports System.Threading

    statement directly, or by referencing a library that includes that line. When this is done, the OnTick event is fired twice. For example, the following is logged, so it seems to be serial, not simultaneous (Can't be sure though).

    ----------------------------------------------------------------------------
    09:11:43:S001 Service Started
    ----------------------------------------------------------------------------
    09:13:44:Timer Ticked - Interval =  120000
    09:13:52:Timer Ticked - Interval =  120000
    ----------------------------------------------------------------------------
    09:14:04:S002 Service Stopped
    ----------------------------------------------------------------------------

    I think Olle probably had the same problem here some time ago.

    When the same code runs in a console application, the time fires once. When references to threading are removed, the timer fires once. In a service with threading - twice!

    Any ideas anybody?

    David

     

    Friday, January 12, 2007 7:46 AM

Answers

  • Me again

    WOW!!! I found the answer in the very next thread

    I didn't know there was a threading.timer object

    Cheers

     

    Friday, January 12, 2007 9:12 AM