Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does a thread affect timer tick event

Status
Not open for further replies.

nishasp

Programmer
May 13, 2004
33
GB
Hi,

I am running a thread that goes to sleep every 150ms. At some point in my application I enable a timer for it to make a button flash different colours. Although the timer gets enabled, it is not stepping through to the timer tick event to make the button flash.

Does a thread affect the timer tick event?

Thanks,

nisha
 
In multithreadhing you should avoid Thread.Sleep() or Thread.SpinWait().
Only Thread.Sleep(0) is acceptable optimization technique to force a context switch.
Thread.Sleep(int) is acceptable in testing or simulation code.
Try to use Monitor.Wait(object o, int millisec) but the solution is to use auto-reset events.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top