is it possible to use threading timer to fire worker threads on timer event?
I want use threading.Timer because I am intending to using a windows service triggered by time, but all the example code I see using timer are using callback/threadpool instead. But in my service, the task will be longer than a few seconds (up to a minutes) and involve rather complex logic rather than just update a few fields. I think that would justify my choice of workerthread rather than threadpool?
I had a similar situation where I needed a collection of threading timers. If my window service was stopped I needed any ongoing timer callbacks to complete.
You can use a WaitHandle when you dispose your timer, allowing any ongoing callbacks to complete:
Here is my related question I haven’t run into any issues..yet. My callbacks do some heavy processing that would take up to 10-20 minutes to complete.