C
cody
the common used idiom is like this:
MyDelegate d = MyEvent;
// receiver of the event unsubscribes after this line in another thread
if (d!=null)
d(this, EventArgs.Empty);
Am I right if I think that it is possible that in a multithreaded
environment an object may receive an event *after* it has unsubscribed from
that event?
obj.MyEvent -= myMethod;
// is it possible that this object can still receive an event after this
line?
MyDelegate d = MyEvent;
// receiver of the event unsubscribes after this line in another thread
if (d!=null)
d(this, EventArgs.Empty);
Am I right if I think that it is possible that in a multithreaded
environment an object may receive an event *after* it has unsubscribed from
that event?
obj.MyEvent -= myMethod;
// is it possible that this object can still receive an event after this
line?