//Aplicativo de console para Enfiar using System.Threading em C # 1.1 e 2.0 (Dot Net)
using System;
using System.Threading;
namespace thred
{
classe thred
{
static void Main ( )
{
cs mt = new cs ();
mt.t1 = new Thread (novo ThreadStart (mt.method1));
mt.t2 = new Thread (novo ThreadStart (mt.method2));
mt.t1.Start ();
mt.t2.Start ();
Console.
ReadLine ();
}
}
classe cs
{
t1 Tópico público, t2;
method1 public void ()
{
for (int j = 0; j
{
Console.WriteLine ("Thread1" + j);
Thread.Sleep (1000),
}
t2.Suspend ();
t2.Resume ();
}
public void method2 ()
{
t1.Suspend ();
t1.Resume ();
para (int i = 0; i
{
Console.WriteLine ("Thread2" + i);
Thread.
Sleep (2000);
}
}
}
}