Events are executed in the current thread or in a new one.

When an event occurs, the handler is executed in the same thread as the main program or in another thread ?.

Thank!

+3
source share
1 answer

It starts in the thread that triggered the event.

Examples:

  • User presses button: GUI stream.
  • A background thread updates an object property: this background thread
  • WCF message received: thread from thread pool

If you are working with a graphical interface, this often means that you need to output an event from a background thread to a GUI thread before touching any controls.

+3
source

Source: https://habr.com/ru/post/1745915/


All Articles