读书人

多线程有关问题怎么启动一个线程去轮

发布时间: 2012-02-01 16:58:19 作者: rapoo

多线程问题,如何启动一个线程去轮殉一个static变量值?
如下所示
class 1
{
private static bool isDownload;


public Dee
{
//在此方法中要启动一个线程去轮询static值
//if(null == isDownload)
// Agent.Install()
}

}
请问怎么写?谢谢告知。一分不少。

[解决办法]
如下所示
class 1
{
private static bool isDownload;


public Dee
{
//在此方法中要启动一个线程去轮询static值
//if(null == isDownload)
// Agent.Install()
Thread t = new Thread(new ThreadStart(mydo));
t.start();
}
private void myDo()
{
while(true)
{
if(null == isDownload)
Agent.Install();

Thread.Sleep(100);
}
}
}

读书人网 >C#

热点推荐