public class Foo
{
void TimerElapsed(object o)
{
Debug.Print("Elapsed !");
}
public void Initialize()
{
Timer theTimer = new Timer(new TimerCallback(TimerElapsed), null, 0, 30);
Debug.Print("Immediate timer that call back every 30ms");
Thread.Sleep(Timeout.Infinite);
}
}
thread.sleep(timeout.infinite) is needed if you no longer need to process anything in that particular thread. So if you run that code in it’s own thread, you should; if you call it in amongst your other code, then you’re correct and you don’t need it.
In fact, there is not a major difference between timers in the normal and micro framework…The real goal is to use “best practices” in merging timers and threads together to make your system work properly…