Difference between Barrier in C# 4.0 and WaitHandle in C# 3.0?

前端 未结 5 764
生来不讨喜
生来不讨喜 2020-12-19 02:43

I am picking up C# 4.0 and one of the things which is confusing me, is the barrier concept.

Is this not just like using the WaitAll method of WaitHandle

5条回答
  •  粉色の甜心
    2020-12-19 02:49

    Seems like a counted waithandle to me. Gives you the convenience to say "when the number of threads waiting on this lock becomes X, let them all go." It's nothing you can't do with another construct, but it does seem convenient.

提交回复
热议问题