简体   繁体   中英

Only fire Timer event after previous Elapsed event has finished? [c#]

仅在上一个Elapsed事件结束后才可以触发System.Timers.Timer.Elapsed吗?

A common pattern to avoid this.

  • Start the timer
  • Stop it in the beginning of the handler
  • Start it again at the end of the handler

This guarantees you can only ever be processing the handler once.

Timer.Interval属性可能对您有所帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM