当前位置: 首页 > news >正文

商务网站建设网站开发襄阳大摩网站建设

商务网站建设网站开发,襄阳大摩网站建设,做个网站需要学会什么,wordpress有什么缺点ManualResetEvent 允许线程通过发信号互相通信。通常#xff0c;此通信涉及一个线程在其他线程进行之前必须完成的任务。 public static ManualResetEvent mre new ManualResetEvent(false); ManualResetEvent建立时是把false作为start的初始状态#xff0c;这个类用于通知另…ManualResetEvent 允许线程通过发信号互相通信。通常此通信涉及一个线程在其他线程进行之前必须完成的任务。 public static ManualResetEvent mre new ManualResetEvent(false); ManualResetEvent建立时是把false作为start的初始状态这个类用于通知另一个线程让它等待一个或多个线程。注意为了通知或监听同一个线程所有的其它线程都能访问那个类。 等待线程这样写   mre.WaitOne(); 这将引起等待线程无限期的阻塞并等待类来通知。 发信号的线程应该这样   mre.Set(); 这样类就会被通知值变成true等待线程就会停止等待。在通知事件发生后我们就可以使用下面语句把线程置于非终止状态导致线程阻止   mre.Reset();一个测试的例子 using System;using System.Threading;namespace ThreadingTester{    class ThreadClass    {        public static ManualResetEvent mre  new ManualResetEvent(false);        public static void trmain()        {            Thread tr  Thread.CurrentThread;            Console.WriteLine(thread: waiting for an event);            mre.WaitOne();            Console.WriteLine(thread: got an event);            for (int x  0; x  10; x)            {                Thread.Sleep(1000);                mre.WaitOne();                Console.WriteLine(tr.Name  :   x);            }        }        static void Main(string[] args)        {            Thread thrd1  new Thread(new ThreadStart(trmain));            thrd1.Name  thread1;            thrd1.Start();            for (int x  0; x  10; x)            {                Thread.Sleep(900);                Console.WriteLine(Main:  x);                if (5  x) mre.Set();                if (6  x) mre.Reset();                if (8  x) mre.Set();            }            while (thrd1.IsAlive)            {                Thread.Sleep(1000);                Console.WriteLine(Main: waiting for thread to stop);            }        }    }} 运行的结果为thread: waiting for an event Main:0 Main:1 Main:2 Main:3 Main:4 Main:5 thread: got an event Main:6 Main:7 Main:8 thread1: 0 Main:9 thread1: 1 Main: waiting for thread to stop thread1: 2 Main: waiting for thread to stop thread1: 3 Main: waiting for thread to stop thread1: 4 Main: waiting for thread to stop thread1: 5 Main: waiting for thread to stop thread1: 6 Main: waiting for thread to stop thread1: 7 Main: waiting for thread to stop thread1: 8 Main: waiting for thread to stop thread1: 9 Main: waiting for thread to stop 转载于:https://www.cnblogs.com/fengfeng/archive/2008/06/24/1229037.html
http://wiki.neutronadmin.com/news/54497/

相关文章:

  • 什么都不懂做网站怎么提升网站的流量
  • 网站建设实验小结佛山网站建设公司招聘
  • 如何购买建设网站系统手机百度怎么翻译网页
  • 昆明建设咨询监理有限公司网站win10优化大师是官方的吗
  • 网站建设合同印花税税率如何做微信网站防封
  • 首都医科大学网站建设网站建设佰首选金手指三十
  • ie浏览器打开建设银行网站网络管理系统中管理对象
  • 免费网站看完你会回来感谢我的青海网站推广策划方案
  • 网站建设广州市软件工程属于哪个大类
  • 网站建设与管理案例教程教学大纲电商设计专业
  • 创新的品牌网站建设网博士自助建站系统
  • 教育学校网站做管理系统和网站哪个好做
  • 网站建设智推网提高网站权重的作用
  • 阿里巴巴网站特色广告设计案例网站
  • 网站开发盈亏平衡分析表谁知道免费网站
  • 新密做网站贵州铁路投资建设网站
  • 广东省建设工程安监局网站专门装修的网都有什么网网站
  • 织梦 公司网站模板网站建设找导师蓝林
  • 西安北郊网站开发wordpress 权限插件
  • 郓城那家网站做的好新建wordpress模板
  • 站长之家网站流量查询凡客旗下商城
  • 服务器网站建设东莞做公司网站
  • asp网站用什么数据库网站 租用服务器价格
  • 网站的简介怎么在后台炒做东莞网站优化一般多少钱
  • 网站关键词如何做优化网站建设找哪家公司比较好
  • 呼和浩特网站运营广州企业建站公司
  • 织梦网站上传图片不行咸阳网站建设报价
  • 石家庄定制网站建设多少钱网站页面设计如何收费
  • 做诚信通谁给做网站郴州网站制作公司在哪里
  • 广州开发区建设局网站镇江seo