Hans and I had small discussion recently about the subject and I'm curious how it is really implemented.
See initial talking in the comments here: Are c# timers naturally multithreaded?
Hans and I had small discussion recently about the subject and I'm curious how it is really implemented.
See initial talking in the comments here: Are c# timers naturally multithreaded?
Staring at the .Net 4.0 reference source, System.Timers.Timer
seems to use a System.Threading.Timer
to handle the actual implementation details. The latter generates timers by calling AddTimerNative
. AddTimerNative
is an internal call.
Googling AddTimerNative
lead to a lot of interesting results, including Willy Denoyette's comment, where he states that it calls CreateTimerQueueTimer.
That page states that "Callback functions are queued to the thread pool. "
Well, I did some investigations... Details are in my blog post
To be short, just summary from there: