我可能超出了 AutoResetEvent 的正确设计,但不知道该转向什么。我想要这种行为:
var autoResetEvent = new AutoResetEvent(false);
autoResetEvent.Set();
autoResetEvent.Set();
autoResetEvent.WaitOne();
// since Set was called twice, I don't want to wait here
autoResetEvent.WaitOne();
不幸的是(对于我的问题),这不是 AutoResetEvent 的行为方式。对于这种情况,最好的类是什么?
注意:我可以访问 .NET 并行扩展库。