Exemplo n.º 1
0
public static void Main()
{
mythread mt1 = new mythread("1");
mythread mt2 = new mythread("2");
mt1.thr.Priority = ThreadPriority.AboveNormal;
mt2.thr.Priority = ThreadPriority.BelowNormal;
Thread.Sleep(1000);

}
Exemplo n.º 2
0
public static void Main()
{
Thread thmain = Thread.CurrentThread;

Console.WriteLine("Entering Main thread");
mythread my = new mythread();
Thread.Sleep(2500);
Console.WriteLine(thmain.IsAlive);
Console.WriteLine("Stopping thread");
my.th.Abort(100);
my.th.Join();
Console.WriteLine("Main thread terminating");
}
Exemplo n.º 3
0
public static void Main()
{
Console.WriteLine("Entering main thread");
mythread my = new mythread("child 1", 100);
mythread my1 = new mythread("child 2",10);
mythread my2 = new mythread("child 3",50);
mythread my3 = new mythread("child 4",70);

while(my.th.IsAlive || my1.th.IsAlive || my2.th.IsAlive || my3.th.IsAlive)
{
Console.WriteLine("main still waiting");
Thread.Sleep(1000);
}
Console.WriteLine("Exiting main thread");

}