I want to raise a series of events from my library class, but I\'m worried that some event subscribers will be rude and take a long time to process some events, thus blocking th
I found a similar question on another site, and of course Jon Skeet had answered it. For my scenario, I chose to raise the event for each subscriber on a separate thread:
if (packet != null && DataPacketReceived != null)
{
var args = new DataPacketEventArgs(packet);
var receivers = DataPacketReceived.GetInvocationList();
foreach (EventHandler<DataPacketEventArgs> receiver in receivers)
{
receiver.BeginInvoke(this, args, null, null);
}
}