Skip to content

Commit e9f8085

Browse files
authored
Merge branch 'main' into dev/picking-transparent
2 parents fa75f1f + e8f3fc5 commit e9f8085

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

libs/utils/src/JobSystem.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,30 @@ void JobSystem::setThreadPriority(Priority priority) noexcept {
134134
slog.w << "setpriority failed: " << strerror(errno) << io::endl;
135135
}
136136
#endif
137+
#elif defined(__APPLE__)
138+
qos_class_t qosClass = QOS_CLASS_DEFAULT;
139+
switch (priority) {
140+
case Priority::BACKGROUND:
141+
qosClass = QOS_CLASS_BACKGROUND;
142+
break;
143+
case Priority::NORMAL:
144+
qosClass = QOS_CLASS_DEFAULT;
145+
break;
146+
case Priority::DISPLAY:
147+
qosClass = QOS_CLASS_USER_INTERACTIVE;
148+
break;
149+
case Priority::URGENT_DISPLAY:
150+
qosClass = QOS_CLASS_USER_INTERACTIVE;
151+
break;
152+
}
153+
errno = 0;
154+
UTILS_UNUSED_IN_RELEASE int error;
155+
error = pthread_set_qos_class_self_np(qosClass, 0);
156+
#ifndef NDEBUG
157+
if (UTILS_UNLIKELY(error)) {
158+
slog.w << "pthread_set_qos_class_self_np failed: " << strerror(errno) << io::endl;
159+
}
160+
#endif
137161
#endif
138162
}
139163

0 commit comments

Comments
 (0)