代码改变世界

随笔档案-2011年8月29日

volatile (C# Reference) (转自msdn)

2011-08-29 22:42 by Dirichlet, 369 阅读, 收藏,
摘要: The volatile keyword indicates that a field might be modified by multiple threads that are executing at the same time. Fields that are declared volati 阅读全文

对制造者线程和使用者线程进行同步

2011-08-29 22:01 by Dirichlet, 356 阅读, 收藏,
摘要: 初始化如下: 等待线程如下: 触发事件的线程如下: 1. 触发事件的线程autoRestEvent.Set()发出信号; 2. 等待线程autoRestEvent.WaitOne()得到信号,并立刻将事件重置为无信号状态,开始往后执行。 3. 可以像1,2步一样继续使用Set, WaitOne进行同 阅读全文