C#多线程并发(请问一下这个是不是线程的并发啊?)
private void bt_DownLoadAuth_Start_Click(object sender, EventArgs e){
DownLoadAuthResult.Clear();
for (int i = 1; i < num_DownLoadAuth.Value + 1; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(getServerAuth));
}
}
public void getTaskList(object obj)
{
this.Invoke((Platform.EmptyEventHandler)delegate()
{
DataSet_ThreadInfo.ThreadInfoRow tInfoRow = TaskResult.ThreadInfo.NewThreadInfoRow();
tInfoRow.BeginTime = System.DateTime.Now;
//调用服务器端方法
TaiJi.HGJS.Common.DataSets.XZ_AjListDS bmzbaj;
TaiJi.HGJS.Common.DataSets.XZ_AjListDS dbaj;
TaiJi.HGJS.Common.DataSets.XZ_SpListDS dpaj;
TaiJi.HGJS.Common.DataSets.XZ_AjListDS lzaj;
DateTime ybajBeginDate = System.DateTime.Now.AddMonths(2);
DateTime ybajEndDate = System.DateTime.Now;
TaiJi.HGJS.Common.DataSets.XZ_AjListDS ybaj;
TaiJi.HGJS.Common.DataSets.AJ_YlajListDS ylaj;
TaiJi.HGJS.Client.Common.BLL.BizLogic_XZ.XZ_BIZ_AjList.GetAjList(TaiJi.HGJS.Common.AJ_State.Null, out bmzbaj, out dbaj, out dpaj, out lzaj, ybajBeginDate, ybajEndDate, out ybaj, out ylaj);
tInfoRow.EndTime = System.DateTime.Now;
System.TimeSpan interTime = tInfoRow.EndTime - tInfoRow.BeginTime;
tInfoRow.InterTime = interTime.TotalSeconds;
TaskResult.ThreadInfo.AddThreadInfoRow(tInfoRow);
});
} --------------------编程问答-------------------- 看不懂,顶 --------------------编程问答-------------------- private void bt_DownLoadAuth_Start_Click(object sender, EventArgs e)
{
DownLoadAuthResult.Clear();
for (int i = 1; i < num_DownLoadAuth.Value + 1; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(getServerAuth));
}
}
public void getServerAuth(object obj)
{
this.Invoke((Platform.EmptyEventHandler)delegate()
{
DataSet_ThreadInfo.ThreadInfoRow tInfoRow = TaskResult.ThreadInfo.NewThreadInfoRow();
tInfoRow.BeginTime = System.DateTime.Now;
//调用服务器端方法
TaiJi.HGJS.Common.DataSets.XZ_AjListDS bmzbaj;
TaiJi.HGJS.Common.DataSets.XZ_AjListDS dbaj;
TaiJi.HGJS.Common.DataSets.XZ_SpListDS dpaj;
TaiJi.HGJS.Common.DataSets.XZ_AjListDS lzaj;
DateTime ybajBeginDate = System.DateTime.Now.AddMonths(2);
DateTime ybajEndDate = System.DateTime.Now;
TaiJi.HGJS.Common.DataSets.XZ_AjListDS ybaj;
TaiJi.HGJS.Common.DataSets.AJ_YlajListDS ylaj;
TaiJi.HGJS.Client.Common.BLL.BizLogic_XZ.XZ_BIZ_AjList.GetAjList(TaiJi.HGJS.Common.AJ_State.Null, out bmzbaj, out dbaj, out dpaj, out lzaj, ybajBeginDate, ybajEndDate, out ybaj, out ylaj);
tInfoRow.EndTime = System.DateTime.Now;
System.TimeSpan interTime = tInfoRow.EndTime - tInfoRow.BeginTime;
tInfoRow.InterTime = interTime.TotalSeconds;
TaskResult.ThreadInfo.AddThreadInfoRow(tInfoRow);
});
}昨天发的帖子有点错误不好意思啊! --------------------编程问答-------------------- 你用线程池控制多线程,让他调用getServerAuth(),就看你getServerAuth()方法中有没有唯一的资源被修改操作引起并发冲突
补充:.NET技术 , C#