首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

多线程有关问题,怎么启动一个线程去轮殉一个static变量值

2012-02-01 
多线程问题,如何启动一个线程去轮殉一个static变量值?如下所示class1{privatestaticboolisDownloadpublic

多线程问题,如何启动一个线程去轮殉一个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);
}
}
}

热点排行