http://msdn.microsoft.com/zh-cn/library/c5kehkcz(VS.80).aspxhttp://blog.joycode.com/lostinet/archive/2004/05/21/22123.joyLOCK用法不对
Object thisLock = new Object();
public void AddListenTask(int chnl)
{
try
{
listentask = new IModule.Task();
listentask.Channel = chnl;
listentask.Position = -1;
listentask.Record = null;
//Listen(listentask.Channel);
lock (thisLock)
{
this.TaskQueue.Enqueue(listentask);
//return 1;
}
}
catch (Exception ex)
{
MDRCommon.Logger.GetLogger().Error(ex.Message);
MDRCommon.Logger.GetLogger().Error(ex.StackTrace);
MDRCommon.Logger.GetLogger().Error(ex.Source);
//return 0;
}
}
Object thisLock = new Object();
public void AddListenTask(int chnl)
{
try
{
listentask = new IModule.Task();
listentask.Channel = chnl;
listentask.Position = -1;
listentask.Record = null;
//Listen(listentask.Channel);
lock (thisLock)
{
this.TaskQueue.Enqueue(listentask);
//return 1;
}
}
catch (Exception ex)
{
MDRCommon.Logger.GetLogger().Error(ex.Message);
MDRCommon.Logger.GetLogger().Error(ex.StackTrace);
MDRCommon.Logger.GetLogger().Error(ex.Source);
//return 0;
}
}
解决方案 »
- Visual C# 菜单递归问题
- DevExpress.XtraGrid问题急救.....
- clickonce发布winform的签名问题
- *.wav可否加入到exe文件
- 请教一个CodeSmith的问题
- 测试的一个内存流.为何停住?
- 我做了一个用listView列举系统进程的程序,为什么老是提示“进程计数器已禁用,因此无法执行请求“急急,在线等(分数不够再加)(附原吗
- 首信易支付接口
- 请问如何在richTextBox中实作 drag and drop 的功能呢
- wpf自定义datagrid控件的一些问题
- C#应用类型类型问题,请高手帮忙
- 在datagridview已经绑定的数据里动态添加数据到数据库
锁用得不对,
Lock(this)
{
..........
}