摘要:
usingSystem; usingSystem.ComponentModel; usingSystem.Windows.Forms; usingSystem.Threading; namespaceAutoResetEventTest { publicpartialclassForm1:Form { privateManualResetEventmanualResetEvent; privateAutoResetEventauto; privateboolsuspend; privateAsyncOperationasyncOperation; publicdelegatevoidInvok 阅读全文
posted @ 2012-08-22 22:02
好运博客
阅读(925)
评论(0)
推荐(0)
摘要:
写测试工具需要多线程的暂停终止。用C#的 Thread.about() join() resume() suspend()又提示函数过时了,不建议使用。于是四处找方法,信号量、互斥锁什么的方法也不少,找到下面这个方法,倒是很实用,转载如下:C#关于AutoResetEvent的使用介绍(转)AutoResetEvent 允许线程通过发信号互相通信。通常,此通信涉及线程需要独占访问的资源。线程通过调用 AutoResetEvent 上的 WaitOne 来等待信号。如果 AutoResetEvent 处于非终止状态,则该线程阻塞,并等待当前控制资源的线程通过调用 Set 发出资源可用的信号。调用 阅读全文
posted @ 2012-08-22 22:00
好运博客
阅读(26895)
评论(0)
推荐(0)

浙公网安备 33010602011771号