如何正确地同步这个?目前有可能SetData在e.WaitOne()已完成之后调用,因此d可能已被设置为另一个值。我试图插入锁,但它导致了一个死锁。 AutoResetEvent e = new AutoResetEvent(false);
public SetData(MyData d)
{
this.d=d;
e.Set(); // notify that new d
我可能要在AutoResetEvent的正确设计之外,但不太清楚要转向哪个。我想这种行为: var autoResetEvent = new AutoResetEvent(false);
autoResetEvent.Set();
autoResetEvent.Set();
autoResetEvent.WaitOne();
// since Set was called twice, I