A
Armin Zingler
Hi,
I have an object O1 that executes code in thread T1. O1 raises events.
There is an object O2 that runs in thread T2. O2 catches O1's events.
Question:
What happens if O2 is detaching the event handler at the same time as O1
is raising the event? Do I have to handle this special situation explicitly?
Honestly I haven't read/heard that anybody ever cared about this. It would
be pretty much work to do because every event handling object would have to
prevent the event raiser from raising the event while detaching it's own
handlers. Not a good OO way also. I know the "instance members are not
thread safe" part of the Delegate/Multicastdelegate documentation, but I
also think that Events are a basic element in the runtime's infrastructure,
so maybe I don't have to handle the situation explicitly?
Armin
I have an object O1 that executes code in thread T1. O1 raises events.
There is an object O2 that runs in thread T2. O2 catches O1's events.
Question:
What happens if O2 is detaching the event handler at the same time as O1
is raising the event? Do I have to handle this special situation explicitly?
Honestly I haven't read/heard that anybody ever cared about this. It would
be pretty much work to do because every event handling object would have to
prevent the event raiser from raising the event while detaching it's own
handlers. Not a good OO way also. I know the "instance members are not
thread safe" part of the Delegate/Multicastdelegate documentation, but I
also think that Events are a basic element in the runtime's infrastructure,
so maybe I don't have to handle the situation explicitly?
Armin