C#/.NET Fundamentals: Safely and Efficiently Raising Events

added by BlackRabbitCoder
12/5/2011 11:09:25 AM

1 Kicks, 107 Views

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.


12/1/2011 9:38:35 PM
New post!