in particular, is the operation “+ =” an atom? does it matter if i use the keyword "event" or just a plain old delegate?
with most types, read it, then the + operator, and then write. so it's not atomic. I would like to know if there is a special case for delegates / events.
this code is necessary or redundant:
Action handler;
object lockObj;
public event Action Handler {
add { lock(lockObj) { handler += value; } }
remove { lock(lockObj) { handler -= value; } }
}
source
share