Can't export JUCE examples to Xcode on Monterey

I did a bit more research on the thread priority issue. It looks like I’d been slightly overzealous in an earlier change, which was intended to avoid using realtime priority for all Thread instances on Linux:

Although I think this change does the right thing on Linux and BSD, it seems that the thread scheduling policies have slightly different semantics on macOS, at least according to this page:

The SCHED_OTHER policy is generally used for extra policies that are specific to a given operating system, and should thus be avoided when writing portable code.

None of the macOS documentation I’ve found explicitly states that SCHED_RR is intended for realtime scheduling - it looks like it should be safe for general-purpose threads too. The empirical evidence (i.e. JUCE apps pre-JUCE-6 used SCHED_RR for all threads on macOS, seemingly without issues) also suggests this is the case.

I’ve made a change on develop that puts back the old behaviour, but only on macOS. With this change in place, Projucer saving is much faster again.

We’re planning to do a new point release shortly, so this change will be on master in a week or so.

3 Likes

Ok so, whatever changes happened here have significantly improved Projucer’s saving/exporter exporting, cutting the time down to nearly nothing (this is with several exporters and two configs each). This also explains the crazy slowdowns I was seeing in my multithreaded apps using a ThreadPool, where the time profiler wasn’t showing anything obvious.

1 Like

thanks @reuk , it’s working great for me now.

just came across this related article (“Tuning Your Code’s Performance for Apple Silicon”) which mentions the qos changes for threads on apple hardware:

https://developer.apple.com/documentation/apple-silicon/tuning-your-code-s-performance-for-apple-silicon