System.Threading.Timer相关问题

lbsong 2004-07-13 06:15:58
1.在MSDN的http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/progthrepool.asp这个文章中,看到下面这样的话:

the .NET Framework thread pool offers the possibility of time-dependent requests. With this functionality, we can have hundreds of timers without using any thread—it's the pool itself that will process the request once the timer expires

谁能帮我详细解释一下这段话的意思?

2.在该文中还有这样一句话:
System.Timers.Timer
A component version of System.Threading.Time
我的理解是System.Timers.Timer与System.Threading.Time在实现上基本相同,只是一个System.Timers.Timer可以可视化的插入窗体中,是这样吗?但MSDN的帮助中好像没有明确指出这一点

Thanks
...全文
665 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
icedsb 2004-11-03
  • 打赏
  • 举报
回复
建议MSDN用中文的2003版的
whatnamecaniuse 2004-08-12
  • 打赏
  • 举报
回复
如何防止定时器回调的重入?
wsnet 2004-08-11
  • 打赏
  • 举报
回复
谢谢
lkal4587 2004-07-18
  • 打赏
  • 举报
回复
当系统中有活跃的System.Threading.Timer对象,CLR会建立一个Timer线程。

该线程获得执行权时会查询系统中注册的所有System.Threading.Timer对象并

调用相应的回调函数。

在1.0和1.1中,System.Timers.Timer使用windows提供的Waitable Timer。所以System.Timers.Timer与System.Threading.Timer的实现不同。

在Whidbey System.Timers.Timer使用System.Threading.Timer。区别在于System.Timers.Timer可以用于可视化的插入窗体中。

http://blog.joycode.com/gangp/posts/27745.aspx
tiger999 2004-07-18
  • 打赏
  • 举报
回复
Timers.Timer 不提供callback机制
Threading.Timer 提供callback 机制
terryxin 2004-07-17
  • 打赏
  • 举报
回复
up`
lbsong 2004-07-16
  • 打赏
  • 举报
回复
Thanks
我再琢磨琢磨
superct 2004-07-15
  • 打赏
  • 举报
回复
System.Timers.Timer是使用System.Threading.Time机制的可视化控件.
我的理解是.net系统中使用的timer是系统自动取自于线程池, 你可以使用任意多个timer(数量好像在machine.config中有上限)而不必关心线程的创建, 调度, 同步, 销毁, 系统会帮你完成这些操作.
lyrixliu 2004-07-15
  • 打赏
  • 举报
回复
System.Windows.Forms.Timer
The Windows timer is designed for a single-threaded environment where UI threads are used to perform processing. The accuracy of Windows timers is limited to 55 milliseconds. These traditional timers require that the user code have a UI message pump available and always operate from the same thread, or marshal the call onto another thread. For a COM component, this would be detrimental to performance.

System.Timers.Timer
The server-based timer is designed for use with worker threads in a multi-threaded environment. Because they use a different architecture, server-based timers have the potential to be much more accurate than Windows timers. Server timers can move among threads to handle the raised events.

System.Threading.Timer
The thread timer is useful in scenarios where messages are not pumped on the thread. For example, the Windows-based timer relies on operating-system timer support, and if you are not pumping messages on the thread, the event associated with your timer will not occur. The thread timer is more useful in this case.
lbsong 2004-07-14
  • 打赏
  • 举报
回复
up
Alexandria 2004-07-14
  • 打赏
  • 举报
回复
2.在该文中还有这样一句话:
System.Timers.Timer
A component version of System.Threading.Time


一个是后台调用线程的,一个是可以在window窗体中使用的
NEODIO 2004-07-14
  • 打赏
  • 举报
回复
我记得有本书上详细叙述了两种Timer的区别,待俺帮你找找

17,741

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET Framework
社区管理员
  • .NET Framework社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧