Do not put the main thread in realtime or high priority #7436
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main thread was set to run in real-time (or at high priority on Windows) to fix an annoying warning in 733491d. I'm not sure what warning would've popped up at the time that justifies doing something like this, but as of right now, this is definitely not something we should doing. The main thread has no business running in real-time and can potentially preempt the processing of the audio threads (which should actually be the threads at a higher priority) because Qt may want to do drawing.
Another major problem is that it seems like GNOME (maybe DE's or something else completely, not sure) enforce a limit on the amount of CPU time a real-time process can take. On my system, its 200ms. It shouldn't come as a surprise that the main thread needs a lot more time to do its work than that. It's allocating memory, loading up the
Engine
, loading plugins, etc. The problem with this is that if the main thread takes more than 200ms of CPU time at any given instance, it will be killed, causing the application to not even start.