日期:2014-05-17 浏览次数:21039 次
Thread[] TdSend;
//执行方法
private void Send(string user,string pwd)
{
//代码块。这里在断点调试时,根本没有进入
}
private void btn_send_Click(object sender, EventArgs e)
{
DataSet ds = eDao.GetSendInfo();
if (ds == null)
{
MessageBox.Show("获取信息失败!", "提示:");
return;
}
dtAccount = ds.Tables["Account"];
dtAddress = ds.Tables["Address"];
TdSend = new Thread[int.Parse(tb_ThreadNum.Text)];
for (int k = 0; k < TdSend.Length; k++)
{
string user = dtAccount.Rows[0]["UserName"].ToString();
string pwd = dtAccount.Rows[0]["PassWord"].ToString();
dtAccount.Rows.RemoveAt(0);
TdSend[k] = new Thread(delegate() { Send(user, pwd); });
TdSend[k].Start();
}
}
static Thread[] TdSend;
private static readonly object lck = new object();
static void Main(string[] args)
{
TdSend = new Thread[3];
string a = "1";
string b&nbs