I need some kind of a timer, but the problem with existing timers is: timer's callback is executed in some thread of threadpool. That's why callbacks need to be thread-safe and reentrant.
Idea like
while (true)
{
// do some work
Thread.Sleep(1000);
}
seems wrong to me. So what is idiomatic for periodic running action in single thread?