private static void FunWithMRE() { ManualResetEventSlim mre = new ManualResetEventSlim(); //MRE mre = new MRE(); mre.WaitAsync().ContinueWith(t => CW("Wait 1 complete")); mre.WaitAsync().ContinueWith(t => CW("Wait 2 complete")); mre.WaitAsync().ContinueWith(t => CW("Wait 3 complete")); WaitUntilKey("set"); mre.Set(); mre.WaitAsync().ContinueWith(t => CW("Wait 4 complete")); mre.WaitAsync().ContinueWith(t => CW("Wait 5 complete")); mre.WaitAsync().ContinueWith(t => CW("Wait 6 complete")); //WaitUntilKey("reset"); mre.Reset(); mre.WaitAsync().ContinueWith(t => CW("Wait 7 complete")); mre.WaitAsync().ContinueWith(t => CW("Wait 8 complete")); mre.WaitAsync().ContinueWith(t => CW("Wait 9 complete")); WaitUntilKey("set again"); mre.Set(); }