开发者

What is the easiest way to pause Consumer in P-C pattern?

I have typical producer-consumer application. I have BlockingCollection to provide producing-consuming mechanism. What I need is to add ability to pause consumer thread execution fr开发者_如何学JAVAom another thread. I've read about different .net synchronization primitives but I can't decide how to implement it in the easiest way.

P.S.: I use .net 4.0.


Use an AutoResetEvent and wait on it in the Consumer until the other thread wakes it up again, by setting it to signaled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜