线程的问题,有代码
如一下代码,线程应该是每隔一秒,label的值变化一次,加t1,可为什么只执行一次?
using System;
using System.Collections;
using System.Threading;
namespace comtrans
{
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
Thread thread1 = new Thread(new ThreadStart(Method1));
thread1.Start();
}
public void Method1()
{
while(true)
{
this.Label2.Text +="t1";
System.Threading.Thread.Sleep(1000);
}
}
}}