AutoResetEvent用法
来源:互联网 发布:c语言编程判断题 编辑:程序博客网 时间:2024/06/05 18:04
using System.Threading;
namespace ConsoleApplication34
{
class Class3
{
public static AutoResetEvent _AutoSwitch = null;
private List<int> _Lst = new List<int> ();
private void init()
{
if (_AutoSwitch == null)
{
_AutoSwitch = new AutoResetEvent(false);
}
}
public void AddLst(int tmp)
{
//线程结束等待:
_Lst.Add(tmp);
_AutoSwitch.Set();
}
private void ThreadProc()
{
while (true)
{
int sleep = 30;
if (_Lst.Count <= 0)
{
//线程等待;
_AutoSwitch.WaitOne();
}
else
{
//........
}
}
}
}
}
namespace ConsoleApplication34
{
class Class3
{
public static AutoResetEvent _AutoSwitch = null;
private List<int> _Lst = new List<int> ();
private void init()
{
if (_AutoSwitch == null)
{
_AutoSwitch = new AutoResetEvent(false);
}
}
public void AddLst(int tmp)
{
//线程结束等待:
_Lst.Add(tmp);
_AutoSwitch.Set();
}
private void ThreadProc()
{
while (true)
{
int sleep = 30;
if (_Lst.Count <= 0)
{
//线程等待;
_AutoSwitch.WaitOne();
}
else
{
//........
}
}
}
}
}
0 0
- AutoResetEvent用法
- 浅谈AutoResetEvent的用法
- 浅谈AutoResetEvent的用法
- AutoResetEvent和ManualResetEvent用法
- 浅谈AutoResetEvent的用法
- 浅谈AutoResetEvent的用法
- 浅谈AutoResetEvent的用法
- AutoResetEvent用法(一)
- AutoReSetEvent用法(二)
- 浅谈AutoResetEvent的用法
- 浅谈AutoResetEvent的用法(转)
- 浅谈AutoResetEvent的用法(转)
- 转:浅谈AutoResetEvent的用法
- AutoResetEvent
- AutoResetEvent
- AutoResetEvent
- AutoResetEvent
- AutoResetEvent
- notification中的图标
- IOS 10 权限声明及国际化
- 新版 Primavera P6 乱码问题
- Android Studio如何导入第三方主题
- 数据结构基本排序算法
- AutoResetEvent用法
- weblogic登陆界面不跳转解决方法
- 深入理解Java的接口和抽象类
- win32之组合框
- 同余定理在算法求解中的应用
- NYOJ 10 - Skiing
- spring实现访问次数控制
- 深入浅出java多线程(总结)
- win32之列表框