views:

59

answers:

2

So, according to MSDN, System.Threading.Timer calls it's callback delegate on a ThreadPool thread. Is there any way to make it use a custom ThreadPool? (For instance, Jon Skeet's CustomThreadPool.)

A: 

I don't believe so.

Steven Sudit
+2  A: 

Not using System.Threading.Timer, no. Using System.Timers.Timer I believe you could if the thread pool in question implemented ISynchronizeInvoke accordingly. I believe the timer will call BeginInvoke on its SynchronizingObject to execute the callback accordingly. If a thread pool implemented ISynchronizeInvoke to mean "add the callback to the work queue" it should work fine.

(Mine doesn't do implement it, but it probably wouldn't be too hard to do. My thread pool is extremely primitive btw - or at the very least it's very old! - there are almost certainly better ones available now.)

Jon Skeet
Thanks for the confirmation, I was hoping that you'd have some input.
wizlb