[C#] 纯文本查看 复制代码 public bool bool1;
public Thread three1;
private void button4_Click(object sender, EventArgs e) {
bool1 = true;
three1 = new Thread(test);
three1.Start();
}
private void button5_Click(object sender, EventArgs e) {
try {
bool1 = false;
three1.Abort();
//关闭资源
} catch (Exception ex) { }
}
public void test() {
while (bool1) {
//资源使用
}
} |