@@ -154,7 +154,10 @@ struct dispatch_root_queue_context_s {
154
154
int volatile dgq_pending ;
155
155
#if DISPATCH_USE_WORKQUEUES
156
156
qos_class_t dgq_qos ;
157
- int dgq_wq_priority , dgq_wq_options ;
157
+ #if HAVE_PTHREAD_WORKQUEUES
158
+ int dgq_wq_priority ;
159
+ #endif
160
+ int dgq_wq_options ;
158
161
#if DISPATCH_USE_LEGACY_WORKQUEUE_FALLBACK || DISPATCH_USE_PTHREAD_POOL
159
162
pthread_workqueue_t dgq_kworkqueue ;
160
163
#endif
@@ -182,7 +185,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
182
185
[DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS ] = {{{
183
186
#if DISPATCH_USE_WORKQUEUES
184
187
.dgq_qos = QOS_CLASS_MAINTENANCE ,
188
+ #if HAVE_PTHREAD_WORKQUEUES
185
189
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE ,
190
+ #endif
186
191
.dgq_wq_options = 0 ,
187
192
#endif
188
193
#if DISPATCH_ENABLE_THREAD_POOL
@@ -193,7 +198,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
193
198
[DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS_OVERCOMMIT ] = {{{
194
199
#if DISPATCH_USE_WORKQUEUES
195
200
.dgq_qos = QOS_CLASS_MAINTENANCE ,
201
+ #if HAVE_PTHREAD_WORKQUEUES
196
202
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE ,
203
+ #endif
197
204
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT ,
198
205
#endif
199
206
#if DISPATCH_ENABLE_THREAD_POOL
@@ -204,7 +211,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
204
211
[DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS ] = {{{
205
212
#if DISPATCH_USE_WORKQUEUES
206
213
.dgq_qos = QOS_CLASS_BACKGROUND ,
214
+ #if HAVE_PTHREAD_WORKQUEUES
207
215
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE_CONDITIONAL ,
216
+ #endif
208
217
.dgq_wq_options = 0 ,
209
218
#endif
210
219
#if DISPATCH_ENABLE_THREAD_POOL
@@ -215,7 +224,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
215
224
[DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS_OVERCOMMIT ] = {{{
216
225
#if DISPATCH_USE_WORKQUEUES
217
226
.dgq_qos = QOS_CLASS_BACKGROUND ,
227
+ #if HAVE_PTHREAD_WORKQUEUES
218
228
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE_CONDITIONAL ,
229
+ #endif
219
230
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT ,
220
231
#endif
221
232
#if DISPATCH_ENABLE_THREAD_POOL
@@ -226,7 +237,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
226
237
[DISPATCH_ROOT_QUEUE_IDX_UTILITY_QOS ] = {{{
227
238
#if DISPATCH_USE_WORKQUEUES
228
239
.dgq_qos = QOS_CLASS_UTILITY ,
240
+ #if HAVE_PTHREAD_WORKQUEUES
229
241
.dgq_wq_priority = WORKQ_LOW_PRIOQUEUE ,
242
+ #endif
230
243
.dgq_wq_options = 0 ,
231
244
#endif
232
245
#if DISPATCH_ENABLE_THREAD_POOL
@@ -237,7 +250,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
237
250
[DISPATCH_ROOT_QUEUE_IDX_UTILITY_QOS_OVERCOMMIT ] = {{{
238
251
#if DISPATCH_USE_WORKQUEUES
239
252
.dgq_qos = QOS_CLASS_UTILITY ,
253
+ #if HAVE_PTHREAD_WORKQUEUES
240
254
.dgq_wq_priority = WORKQ_LOW_PRIOQUEUE ,
255
+ #endif
241
256
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT ,
242
257
#endif
243
258
#if DISPATCH_ENABLE_THREAD_POOL
@@ -248,7 +263,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
248
263
[DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS ] = {{{
249
264
#if DISPATCH_USE_WORKQUEUES
250
265
.dgq_qos = QOS_CLASS_DEFAULT ,
266
+ #if HAVE_PTHREAD_WORKQUEUES
251
267
.dgq_wq_priority = WORKQ_DEFAULT_PRIOQUEUE ,
268
+ #endif
252
269
.dgq_wq_options = 0 ,
253
270
#endif
254
271
#if DISPATCH_ENABLE_THREAD_POOL
@@ -259,7 +276,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
259
276
[DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS_OVERCOMMIT ] = {{{
260
277
#if DISPATCH_USE_WORKQUEUES
261
278
.dgq_qos = QOS_CLASS_DEFAULT ,
279
+ #if HAVE_PTHREAD_WORKQUEUES
262
280
.dgq_wq_priority = WORKQ_DEFAULT_PRIOQUEUE ,
281
+ #endif
263
282
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT ,
264
283
#endif
265
284
#if DISPATCH_ENABLE_THREAD_POOL
@@ -270,7 +289,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
270
289
[DISPATCH_ROOT_QUEUE_IDX_USER_INITIATED_QOS ] = {{{
271
290
#if DISPATCH_USE_WORKQUEUES
272
291
.dgq_qos = QOS_CLASS_USER_INITIATED ,
292
+ #if HAVE_PTHREAD_WORKQUEUES
273
293
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE ,
294
+ #endif
274
295
.dgq_wq_options = 0 ,
275
296
#endif
276
297
#if DISPATCH_ENABLE_THREAD_POOL
@@ -281,7 +302,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
281
302
[DISPATCH_ROOT_QUEUE_IDX_USER_INITIATED_QOS_OVERCOMMIT ] = {{{
282
303
#if DISPATCH_USE_WORKQUEUES
283
304
.dgq_qos = QOS_CLASS_USER_INITIATED ,
305
+ #if HAVE_PTHREAD_WORKQUEUES
284
306
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE ,
307
+ #endif
285
308
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT ,
286
309
#endif
287
310
#if DISPATCH_ENABLE_THREAD_POOL
@@ -292,7 +315,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
292
315
[DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS ] = {{{
293
316
#if DISPATCH_USE_WORKQUEUES
294
317
.dgq_qos = QOS_CLASS_USER_INTERACTIVE ,
318
+ #if HAVE_PTHREAD_WORKQUEUES
295
319
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE_CONDITIONAL ,
320
+ #endif
296
321
.dgq_wq_options = 0 ,
297
322
#endif
298
323
#if DISPATCH_ENABLE_THREAD_POOL
@@ -303,7 +328,9 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
303
328
[DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS_OVERCOMMIT ] = {{{
304
329
#if DISPATCH_USE_WORKQUEUES
305
330
.dgq_qos = QOS_CLASS_USER_INTERACTIVE ,
331
+ #if HAVE_PTHREAD_WORKQUEUES
306
332
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE_CONDITIONAL ,
333
+ #endif
307
334
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT ,
308
335
#endif
309
336
#if DISPATCH_ENABLE_THREAD_POOL
@@ -5511,7 +5538,7 @@ _dispatch_worker_thread(void *context)
5511
5538
bool manager = (dq == & _dispatch_mgr_root_queue );
5512
5539
bool monitored = !(overcommit || manager );
5513
5540
if (monitored ) {
5514
- _dispatch_workq_worker_register (dq , qc -> dgq_wq_priority );
5541
+ _dispatch_workq_worker_register (dq , qc -> dgq_qos );
5515
5542
}
5516
5543
#endif
5517
5544
@@ -5525,7 +5552,7 @@ _dispatch_worker_thread(void *context)
5525
5552
5526
5553
#if DISPATCH_USE_INTERNAL_WORKQUEUE
5527
5554
if (monitored ) {
5528
- _dispatch_workq_worker_unregister (dq , qc -> dgq_wq_priority );
5555
+ _dispatch_workq_worker_unregister (dq , qc -> dgq_qos );
5529
5556
}
5530
5557
#endif
5531
5558
(void )os_atomic_inc2o (qc , dgq_thread_pool_size , release );
0 commit comments