Events and Threads

  • Thread starter Thread starter Michael D. Ober
  • Start date Start date
M

Michael D. Ober

Can events generated in a worker/background thread via RaiseEvent be handled
safely in the main/display thread? The contents of the event object will be
used to update the display of a Windows forms application.

Thanks,
Mike.
 
Michael,
Can events generated in a worker/background thread via RaiseEvent be handled
safely in the main/display thread?

Events are really just indirect method calls and they run on the
thread that raise the event. If you want something to run on the UI
thread you have to use Control.Invoke/BeginInvoke.


Mattias
 
Thanks.
Mike.

Mattias Sjögren said:
Michael,


Events are really just indirect method calls and they run on the
thread that raise the event. If you want something to run on the UI
thread you have to use Control.Invoke/BeginInvoke.


Mattias
 
Back
Top