Quantcast
Channel: Dúvida com thread
Viewing all articles
Browse latest Browse all 11

Dúvida com thread

$
0
0
protected override void OnStart(string[] args)
 {
    try
      {
       trdMain = new Thread(new ThreadStart(Processo));
                trdMain.Start();
....
      }
      catch (Exception ex)
      {
        // trataerro;
      }
}

private void Processo()
{
            int count1=0;
            int count2=0;
            while (true)
            {
                   count1++;
                   count2++;
                   if(count1==100)
                       { Atividade1();count1=0;} 
                   if(count2==500)
                        {Atividade2();count2=0;}
                   Thread.Sleep(100);
            }
 }
private void Atividade1()
{}
private void Atividade2()
{}
é um modo de se fazer... :P

Viewing all articles
Browse latest Browse all 11