System.Threading.Timer callback gets called after Change(Timeout.Infinite,Timeout.Infinite)

Answered System.Threading.Timer callback gets called after Change(Timeout.Infinite,Timeout.Infinite)

  • Tuesday, June 10, 2008 3:32 PM
     
     

    Hello everyone,

     

    It would seem the System.Threading.Timer callback may be called once even after Change(Timeout.Infinite,Timeout.Infinite).

    Anyone had the same problem?

     

    Thanks

     

All Replies

  • Thursday, June 12, 2008 2:43 AM
    Moderator
     
     Answered

    Hi, lmira

     

    Unlike the System.Windows.Forms.Timer whose Tick event is called by the UI thread, the callback of the System.Threading.Timer is executed on worker threads. So there are chances that when you call the Change method to stop the Threading.Timer, one or even several callbacks are already queued so they will eventually be executed.

     

     

    Best Regards

    Chunsheng Tang