0

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

I'd be glad for any implementation that would produce more stable and legible code. Would be interested to see implementations using C# yield keyword and also F# Async if any.

Thanks.

Fung
  • 7,530
  • 7
  • 53
  • 68
  • this is a very platform/language specific question, you'd get better chance of being answered if you tag it appropriately – Javier Dec 15 '08 at 14:07

1 Answers1

1

Have a look at Jeff Richter PowerThreading library available here. This library has AsyncEnumerator class which leverages 'yield' keyword for performing async operations in a synchrous manner.

There is a screencast about this class, available here:

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

Hope this helps.

Valve.

Valentin V
  • 24,971
  • 33
  • 103
  • 152