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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top