Jump to content

The UI Thread

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Guest_NeedHelp_*

Guest_NeedHelp_*
  • Guests
After reading about threading a little I came across a term, the UI thread. What is the UI thread?

#2
brackett

brackett

    Programmer

  • Members
  • PipPipPipPip
  • 192 posts
The only thread in a Winform app that is allowed to access UI controls. Some murky mojo about the Windows message pump not liking cross thread accesses. VS2005 will warn you about it under the debugger, VS2003 would just let weird stuff like lockups happen because you forgot to Invoke on the UI thread.
All Controls have a InvokeRequired property that you can check to see if your on the UI thread or not. If not, then you need to call Control.Invoke() to get your code moved over to the UI thread or Bad Things Will Hapen ™.