Repository navigation
Keep the main thread's QoS on Apple platforms - #317
Sinan-Karakaya wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change intended to preserve the Apple main thread’s QoS.
No open issues 🎉
What changed in this PR
Preserves the main thread’s QoS on Apple platforms to prevent UIKit system interfaces, such as document pickers, from stalling.
Changes:
- Uses
pthread_main_np()to detect the Apple main thread and skip changes to its scheduling priority. - Keeps existing priority-setting behavior for worker threads and non-Apple platforms.
| File | Description |
|---|---|
lib/thread.cpp |
Guards the SDL thread-priority call to preserve the Apple main thread’s QoS. |
Review effort: Balanced
|
Do you have proof this does anything? |
|
This PR is the one needed for this other PR for Dusklight: TwilitRealm/dusklight#2798 It's currently waiting for this one to be merged. If you try to launch Dusklight on iOS 27.2> without this thread fix, the FilePickerSheet and the renderer of the game will be blocked. Other than this instance, I don't have any other example, but I guess a minimal example could be reproducible |
|
We have hundreds of users that are using iOS just fine without this, and that copilot comment means literally nothing to us, please give us an objective test case we can use to reproduce the problem. |
|
I'll work on a minimal reproducible example in the next couple of days then, I'll link it to you by then :) |
Changing the scheduling policy permanently opts a thread out of QoS. The main thread must keep its user-interactive QoS, or UIKit's out-of-process UI (such as the document picker) stalls.
This behaviour can be observed on Dusklight built for iOS 27.2>= and prevent it from opening system UIs, such as the file picker sheet.