events and thread

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Does anyone know if raising an event spawns threads for each method that
handles the event, or does it just call each of the methods in order?
If it calls the handlers in order, and waits for each to return, can someone
suggest a good paradigm to just spawn a bunch of threads, one for each event
handler?
Thanks,
Yuri
 
Does anyone know if raising an event spawns threads for each method that
handles the event, or does it just call each of the methods in order?

The latter, no threads are created.

If it calls the handlers in order, and waits for each to return, can someone
suggest a good paradigm to just spawn a bunch of threads, one for each event
handler?

You can use Delegate.GetInvocationList to get each event handler
delegate. You may want to consider using the thread pool rather than
creating the threads explicitly.


Mattias
 
Back
Top