-int
-pthread_attr_set_qos_class_np(pthread_attr_t *__attr,
- qos_class_t __qos_class,
- int __relative_priority)
-{
- if (!(__pthread_supported_features & PTHREAD_FEATURE_BSDTHREADCTL)) {
- return ENOTSUP;
- }
+static inline qos_class_t
+_pthread_qos_class_from_thread_qos(thread_qos_t tqos)
+{
+ static const qos_class_t thread_qos_to_qos_class[THREAD_QOS_LAST] = {
+ [THREAD_QOS_UNSPECIFIED] = QOS_CLASS_UNSPECIFIED,
+ [THREAD_QOS_MAINTENANCE] = QOS_CLASS_MAINTENANCE,
+ [THREAD_QOS_BACKGROUND] = QOS_CLASS_BACKGROUND,
+ [THREAD_QOS_UTILITY] = QOS_CLASS_UTILITY,
+ [THREAD_QOS_LEGACY] = QOS_CLASS_DEFAULT,
+ [THREAD_QOS_USER_INITIATED] = QOS_CLASS_USER_INITIATED,
+ [THREAD_QOS_USER_INTERACTIVE] = QOS_CLASS_USER_INTERACTIVE,
+ };
+ if (os_unlikely(tqos >= THREAD_QOS_LAST)) return QOS_CLASS_UNSPECIFIED;
+ return thread_qos_to_qos_class[tqos];
+}