Why is a single threaded model used to update the UI as main thread?
The Qt doc says,
As mentioned, each program has one thread when it is started. This
thread is called the “main thread” (also known as the “GUI thread” in
Qt applications). The Qt GUI must run in this thread.
Can I include a framework in another framework? Change package name to existing Phonegap projects Using camera on Phonegap app with only HTML input, without Camera API iOS UI elements porting on Android Difference between PKCS1-padding/RSA encryption ios objc and java Xcode 6 Error - “Missing Required Architecture i386” When Building for iOS Simulator
The Android doc says,
Like activities and the other components, services run in the main
thread of the application process
It is strongly recommended not to update UI controls etc from a
background thread (e.g. a timer, comms etc). This can be the cause of
crashes which are sometimes very hard to identify. Instead use these
to force code to be executed on the UI thread (which is always the
Why does they use a single threaded model to update UI ?
- Base64 encoding in Swift will not decode in Android
- How to record audio on webpage (iOS, Android, PC/Mac) - no flash
- An error occurred while listing Android targets
- iOS / Android cross platform development
- How to handle multiple markers on Google Maps with same location?
Solutions Collect From Internet About “Why is a single threaded model used to update the UI as main thread?”
The short answer is, it’s the only reasonable way to ensure that the display is not corrupted.
The long answer is that allowing multiple threads to update the UI results in deadlocks, race conditions, and all sorts of trouble. This was the painful lesson taught by Java’s AWT (among other UI systems) that allows multiple threads to touch the UI. See, for instance, this blog post.
- How to get multiple locations of multi touch UITapGestureRecognizer
- UIDatePicker Cutting Off Text & Not Displaying Days
- How to access Core Data generated Obj-C classes in test targets?
- Can I send a Local Notification with no sound?
- Custom UIFont baseline shifted
- Creation Date from Camera Roll Image
- Cordova Phonegap IOS App Settings.Bundle Possible?
- Allow zooming within iFrame but not on page in iOS
- In Xcode how do I know if my lauch image is working correctly?
- Setting up Game Center with Swift
- check if all elements of an array have the same value in Swift
- Perform Segue on ViewDidLoad
- what if when two UITableView in one ViewController and one with custom cell refrence and another is a simple
- Change language of alert in banner of Push Notification
- how can i write a NSData file as Video in to Photolibrary/SavedPhotosAlbum?