0
如何更新線程參數?更新線程參數
string str = "hello world";
private static Thread test = newThread(new ParameterizedThreadStart(invariant_loop));
private void Form1_Load(object sender, EventArgs e)
{
test.Start(str);
}
private static void invariant_loop(object value)
{
do
{
System.Threading.Thread.Sleep(1000);
Console.WriteLine(value.ToString());
}
while (true);
}
private void button1_Click(object sender, EventArgs e)
{
str = maskedTextBox1.Text; // update value ?
}