110,533
社区成员
发帖
与我相关
我的任务
分享
Thread th;
Thread th1;
public test()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
th1 = new Thread(new ThreadStart(bbb));
th = new Thread(new ThreadStart(test1));
th.Priority = ThreadPriority.Normal;
th.Start();
}
private void bbb()
{
MessageBox.Show("ttttttttttttttt");
th.Resume();
th1.Suspend();
}
private void test1()
{
MessageBox.Show("test1");
if (th1.ThreadState == ThreadState.Unstarted)
{
th1.Start();
}
else
{
th1.Resume();
}
th.Suspend();
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(th.ThreadState.ToString());
}