After working in various frameworks such as Win32 API, WPF, Silverlight, Android and iOS over the years, one theme which has been common throughout all these frameworks is the restriction to modify the UI only through UI thread.
There are various ways in these frameworks to modify the UI through a thread other than UI thread. Some of them are captured in the articles below:
- Android - Communicating with UI Thread
- Silverlight - Dispatchign in Silverlight
- iOS - About threaded programming
- WPF - Threading model
Why is such a restriction in place ? Some of these links provide insight:
- Why are most UI frameworks single threaded?
- Multithreaded toolkits: A failed dream?
- Why are GUIs single threaded