Csharp/C Sharp by API/System.Threading/AutoResetEvent

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

AutoResetEvent.WaitOne

<source lang="csharp"> using System; using System.Threading; // AutoReset class Auto {

   [STAThread]
   static void Main() {
       AutoResetEvent aRE = new AutoResetEvent(true);
       bool state = aRE.WaitOne(1000, true);
       Console.WriteLine("After First WaitOne " + state);
       state = aRE.WaitOne(5000, true);
       Console.WriteLine("After Second WaitOne " + state);
   }

}


 </source>