+static boolean_t
+qos_main_thread_active(void)
+{
+ return TRUE;
+}
+
+
+static int proc_usynch_get_requested_thread_qos(struct uthread *uth)
+{
+ task_t task = current_task();
+ thread_t thread = uth ? uth->uu_thread : current_thread();
+ int requested_qos;
+
+ requested_qos = proc_get_task_policy(task, thread, TASK_POLICY_ATTRIBUTE, TASK_POLICY_QOS);
+
+ /*
+ * For the purposes of userspace synchronization, it doesn't make sense to place an override of UNSPECIFIED
+ * on another thread, if the current thread doesn't have any QoS set. In these cases, upgrade to
+ * THREAD_QOS_USER_INTERACTIVE.
+ */
+ if (requested_qos == THREAD_QOS_UNSPECIFIED) {
+ requested_qos = THREAD_QOS_USER_INTERACTIVE;
+ }
+
+ return requested_qos;
+}
+
+static boolean_t proc_usynch_thread_qos_add_override(struct uthread *uth, uint64_t tid, int override_qos, boolean_t first_override_for_resource)
+{
+ task_t task = current_task();
+ thread_t thread = uth ? uth->uu_thread : THREAD_NULL;
+
+ return proc_thread_qos_add_override(task, thread, tid, override_qos, first_override_for_resource, USER_ADDR_NULL, THREAD_QOS_OVERRIDE_TYPE_UNKNOWN);
+}
+
+static boolean_t proc_usynch_thread_qos_remove_override(struct uthread *uth, uint64_t tid)
+{
+ task_t task = current_task();
+ thread_t thread = uth ? uth->uu_thread : THREAD_NULL;
+
+ return proc_thread_qos_remove_override(task, thread, tid, USER_ADDR_NULL, THREAD_QOS_OVERRIDE_TYPE_UNKNOWN);
+}
+
+static boolean_t proc_usynch_thread_qos_add_override_for_resource(task_t task, struct uthread *uth, uint64_t tid, int override_qos, boolean_t first_override_for_resource, user_addr_t resource, int resource_type)
+{
+ thread_t thread = uth ? uth->uu_thread : THREAD_NULL;
+
+ return proc_thread_qos_add_override(task, thread, tid, override_qos, first_override_for_resource, resource, resource_type);
+}
+
+static boolean_t proc_usynch_thread_qos_remove_override_for_resource(task_t task, struct uthread *uth, uint64_t tid, user_addr_t resource, int resource_type)
+{
+ thread_t thread = uth ? uth->uu_thread : THREAD_NULL;
+
+ return proc_thread_qos_remove_override(task, thread, tid, resource, resource_type);
+}
+
+static boolean_t proc_usynch_thread_qos_reset_override_for_resource(task_t task, struct uthread *uth, uint64_t tid, user_addr_t resource, int resource_type)
+{
+ thread_t thread = uth ? uth->uu_thread : THREAD_NULL;
+
+ return proc_thread_qos_reset_override(task, thread, tid, resource, resource_type);
+}