有没有一种方法来暂停所有Threading.Timer定时器? [英] Is there a way to pause all Threading.Timer timers?

查看:463
本文介绍了有没有一种方法来暂停所有Threading.Timer定时器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的C#和我的工作需要几个定时器的程序。

I am new to C# and I am working on a program that require several timers.

我在想,如果有一种方式,当该程序正在运行CPU密集型code同时暂停所有定时器的程序?

I was wondering if there was a way to pause all the timers simultaneously in a program when that program is running CPU intensive code?

目前,当前启用的尝试计时器赶上所有的集约化经营过程中提出的计时器事件。

At the moment, timers that are currently enabled tries to catch up with all the timer events that were raised during the intensive operation.

推荐答案

我认为,你可以创建这些定时器列表(当你激活它们)和手动禁用这些定时器(使用的 Timer.Change 法)。

I think that you can create the list of these timers (when you are activating them) and disable these timers manually (using the Timer.Change method).

这篇关于有没有一种方法来暂停所有Threading.Timer定时器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆