开发者

Timer event does not fire until WaitOne times out

开发者 https://www.devze.com 2023-03-31 20:37 出处:网络
I have a timer that fires periodically to check for new data. Occasionally, I need the timer to fire immediately and I need to wait for timer handler to do its thing before continuing. I tried having

I have a timer that fires periodically to check for new data. Occasionally, I need the timer to fire immediately and I need to wait for timer handler to do its thing before continuing. I tried having the handler set an AutoResetEvent that my main thread would then wait开发者_运维问答 on but this did not work. The timer would not fire until after my call to WaitOne timed out. I have tried using System.Timers.Timer and System.Threading.Timer with the same results. Any ideas as to what I am doing wrong?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号