5 ms·
As of recently, macOS does support priority inheritance for a bunch of synchronization primitives [1], ranging from pthread mutexes to Mach IPC. But it's not p
by comex 5y ago
As of recently, macOS does support priority inheritance for a bunch of synchronization primitives [1], ranging from pthread mutexes to Mach IPC. But it's not perfect. For instance, read-write locks currently don't support priority inheritance, though they could. More problematically, when userland processes use any kind of custom synchronization scheme based on condition variables or similar, there's no way for the kernel to know which thread is expected to signal the condition variable and thus should inherit priority. That includes when libraries implement their own mutexes on top of that [2]...
[1] https://opensource.apple.com/source/xnu/xnu-4903.241.1/osfmk/kern/turnstile.h.auto.html https://opensource.apple.com/source/xnu/xnu-4903.241.1/osfmk...
[2] https://github.com/Amanieu/parking_lot/issues/205 https://github.com/Amanieu/parking_lot/issues/205
- why_only_15 5y agoYou should look into libdispatch, in my understanding, essentially everyone is expected to use libdispatch, and it may have something special to somehow help with priority inheritance.
- saagarjha 5y agoWhere available, libdispatch uses the kernel primitives that support priority inheritance. However, there is nothing that can help you if you are blocked on a task that macOS cannot discern where it might wake up from (this is why waiting on a semaphore is usually not advised).