What if a timer can not finish all its works before the new cycle time arrives?

前端 未结 3 816
醉酒成梦
醉酒成梦 2020-12-13 23:36

Suppose we have a timer which runs every 10 minutes. What if the cycle of its processing takes more than 10 minutes. Does a new thread starts for that? Will it interrupt its

3条回答
  •  心在旅途
    2020-12-14 00:08

    If you're using System.Threading.Timer or System.Timers.Timer, the timer will tick again, starting a new thread. See https://stackoverflow.com/a/10442117/56778 for a way to avoid that problem.

    If you're using System.Windows.Forms.Timer, then a new tick won't occur until the previous one is finished processing.

提交回复
热议问题