0
kicks
C#/.NET Fundamentals: Safely and Efficiently Raising Events
A couple of posts ago, I discussed the EventHandler<TEventArgs> and EventHandler delegates, and in particular at one point mentioned in a sidebar that you need to watch out for thread-safety in order to safely raise events in a multi-threaded environment.
There was an interesting discussion in the comments about different ways that people achieve their thread-safety when raising events, and that got me interested in exploring them more in detail and checking them for performance.
This post examines several ways to raise events in a thread-safe manner, and compares the performance aspects of each.