Last active
October 4, 2015 14:08
-
-
Save hidori/2651034 to your computer and use it in GitHub Desktop.
Waiting asyncronous works completion simpley
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class Syncronized | |
{ | |
public static void Invoke(Action<ManualResetEvent> action) | |
{ | |
if (action == null) throw new ArgumentException("action"); | |
using (var signal = new ManualResetEvent(false)) | |
{ | |
action(signal); | |
signal.WaitOne(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment