Daniel A. Steffen
dsteffen at apple.com
Mon Feb 8 13:00:44 CST 2016
> On Feb 6, 2016, at 17:39, Drew Crawford via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> On Darwin, we have the function qos_class_self(), that we use to find out the QOS of the current queue.
please note that qos_class_self() does _not_ return the QoS of the current queue, it returns the QoS of the current thread, which is quite different, whatever is running on the queue can have changed the QoS, including the attributes of the block itself, if any (possibly automatically propagated from the submitting thread and applied by libdispatch).
> On Linux, this function seems not available.
> Googling suggests qos_class_self comes via libpthread, which might not (?) be the libdispatch implementation on Linux?
> Is there a way to portably create a queue with the current QOS?
QoS itself in its current form is not portable at present and as you say indeed provided by libpthread on Darwin platforms and not libdispatch.
if we need it to be, it might make sense to add support for some of the QoS accessor APIs to the libdispatch Linux port, but I’m not convinced we should be replicating any of the related non-portable functionality until QoS works on Linux more generally (in particular QoS overrides would need kernel support and without that, support for QoS in libdispatch doesn’t make very much sense in the first place given that it will just lead to priority inversions).
More information about the swift-corelibs-dev