Friday, July 15, 2011

C# await for WaitHandle

The async CTP that adds the C# await keyword doesn’t include an awaitable WaitHandle.  It’s easy to add yourself.  Just copy and paste the following code somewhere in your project and you’ll have an awaitable WaitHandle.

Warning: don't use this on AutoResetEvents, or the behavior may not be what you expect.

No comments:

Post a Comment