Let's say I have an event Tick which I call:
public class Test
{
public event Action Tick;
public void Test()
{
Tick();
Console.WriteLine("Tick Finished");
}
}
If I have loads of events subscribed to Tick, will the operation of this thread that is running Test() be blocked until they have all been called or does it perform this asynchronously?
All events are blocking. The thread execution will be blocked until all the event handlers registered to this event have been executed.
While Tick() runs, it will block you from progressing further through the code.
To prove it to yourself, write a console app to do just that, that has a bunch of subscribers to the event, and watch to see what happens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With