Changing the implementation of an async call using ManualResetEvent for one using a combination of Thread methods

I'm looking for a design pattern to switch using ManualResetEvent to use Thread methods like Thread.Join. Right now I am making an asynchronous call and then using ManualResetEvent to wait for the asynchronous call to complete before continuing on the thread that made the call.

I would love any implementation that produces more stable and more readable code. It would be interesting to see implementations using the C # yield keyword as well as F # Async, if any.

Thank.

0


source to share


1 answer


Take a look at Jeff Richter's PowerThreading library available here . This library has an AsyncEnumerator class that uses the "yield" keyword to perform async operations synchronously.

There is a screencast about this class available here:

http://channel9.msdn.com/posts/Charles/Jeffrey-Richter-and-his-AsyncEnumerator/



Hope it helps.

Valve.

+1


source







All Articles