/* * 言語:C#.NET * 内容:Mainという文字が表示されてからThread1が表示されるようにする * */ using System; using System.Threading; class SynchronousTest{ static ManualResetEvent evt; //同期をとるのに使う static void Main(string[] args){ evt = new ManualResetEvent(false); //非シグナル状態にする Thread th1 = new Thread(new ThreadStart(Thread1)); th1.Start(); Console.WriteLine("Main"); evt.Set(); //シグナル状態にする } static void Thread1(){ evt.WaitOne(); //シグナル状態になるまで待つ Console.WriteLine("Thread1"); } }