开发者

Timer tick event in separate thread

开发者 https://www.devze.com 2023-03-07 11:30 出处:网络
Is it anyone how to create a thread for timer tick event. In开发者_开发百科 Windows desktop application timer tick event should

Is it anyone how to create a thread for timer tick event. In开发者_开发百科 Windows desktop application timer tick event should be controlled by a separate thread. Is it possible?


Use System.Threading.Timer and the timer event will fire on a worker thread.

The timer delegate is specified when the timer is constructed, and cannot be changed. The method does not execute on the thread that created the timer; it executes on a ThreadPool thread supplied by the system.

I am assuming that what you mean by "should be controlled by a separate thread" is that the event handler runs on a thread other than the UI thread.

0

精彩评论

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