views:

84

answers:

1

How is access to the UI thread handled in C#?

why is the UI thread treated differently from other threads?

thank you guys for your help

really appreciate it !

+9  A: 

The UI thread contains the Windows Message Pump. This makes it critical to keep this thread from being blocked by long running operations.

Typically, that means pushing anything long running onto a separate thread, and then using Control.Invoke/BeginInvoke (Windows Forms) or Dispatcher.Invoke/BeginInvoke (WPF) to pass delegates from other threads in order to update the UI.

Reed Copsey
It's also worth noting that very little of the GUI system is thread safe, hence why all the GUI processing must be done on the GUI thread.
KeeperOfTheSoul