using System; using System.Threading; namespace ThreadSync { class Program { static void Main(string[] args) { Thread workerThread = new Thread(new ThreadStart(WorkerMethod)); workerThread.Start(); //WorkerMethod(); workerThread.Join(); Console.WriteLine("x = {0}", x); } public static int x = 0; public static void WorkerMethod() { for (int i = 0; i < 1000000; ++i) { ++x; } } } }