File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,30 @@ void JobSystem::setThreadPriority(Priority priority) noexcept {
134
134
slog.w << " setpriority failed: " << strerror (errno) << io::endl;
135
135
}
136
136
#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
137
161
#endif
138
162
}
139
163
You can’t perform that action at this time.
0 commit comments