ManualResetEvent: Set : ManualResetEvent « Development Class « C# / C Sharp






ManualResetEvent: Set

 

using System;
using System.Threading;

class ManualSet{
    [STAThread]
    static void Main(string[] args) {
        ManualResetEvent manRE = new ManualResetEvent(false);
        bool state = manRE.WaitOne(5000, true);
        Console.WriteLine("ManualResetEvent After first WaitOne " + state);

        manRE.Set();
        state = manRE.WaitOne(5000, true);
        Console.WriteLine("ManualResetEvent After second WaitOne " + state);
    }
}
   

 








Related examples in the same category

1.ManualResetEvent: Reset
2.ManualResetEvent.WaitOne