Possible Duplicate:
Checking for null before event dispatching… thread safe?
Raise event thread safely - best practice
protected void NotificationEvent(Object sender, EventArgs e)
{
// Copy to a temporary variable to be thread-safe
EventHandler<EventArgs> tmp = mNotification;
if (tmp!= null)
{
tmp(this, null);
}
}
How does copying mNotification
makes it thread-safe. Can someone explain?