17,740
社区成员
发帖
与我相关
我的任务
分享
Thread newThread = null;
for (int i = 0; i < intMethodCount; i++) //根据行数,产生相应线程
{
strName = dgv_server.Rows[i].Cells["ColumnName"].Value.ToString().Trim();
intID = Convert.ToInt32(dgv_server.Rows[i].Cells["ID"].Value.ToString().Trim());
strThreadName = strName + intID.ToString().Trim();
Execthreads newthread = new Execthreads(intID, strName);
newThread = new Thread(newthread.ExecNewThread) { Name = strThreadName, IsBackground = true };
newThread.Start();
}
foreach (ProcessThread th in Process.GetCurrentProcess().Threads)
{
if (th.ThreadState == System.Diagnostics.ThreadState.Running)
{ n++; }
}