March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
using System.Threading;
namespace Samples
{
public class ThreadPrioritySample
{
public static void StartHere()
{
ThreadPriority[] tps =
{ThreadPriority.AboveNormal,
ThreadPriority.BelowNormal,
ThreadPriority.Normal,
ThreadPriority.Highest,
ThreadPriority.Lowest};
Thread t = Thread.CurrentThread;
foreach(ThreadPriority tp in tps)
{
t.Priority = tp;
Console.WriteLine("ThreadPriority: {0}",
t.Priority);
}
}
public static void Main()
{
Thread t = new Thread(
new ThreadStart(StartHere));
Console.WriteLine("Main starting");
t.Start();
t.Join();
Console.WriteLine("Main finishing");
}
}
}
Main starting ThreadPriority: AboveNormal ThreadPriority: BelowNormal ThreadPriority: Normal ThreadPriority: Highest ThreadPriority: ...
Read now
Unlock full access