Skip to content

Commit bc04960

Browse files
committed
WIP cleanup
1 parent b741481 commit bc04960

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

os/linux_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef __OS_LINUX_BASE__
2020
#define __OS_LINUX_BASE__
2121

22-
#include <sys/event.h>
22+
// #include <sys/event.h>
2323

2424
// marker for hacks we have made to make progress
2525
#define __LINUX_PORT_HDD__ 1

src/queue.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ struct dispatch_root_queue_context_s {
199199
};
200200
typedef struct dispatch_root_queue_context_s *dispatch_root_queue_context_t;
201201

202+
#ifdef __linux__
203+
#define WORKQ_BG_PRIOQUEUE_CONDITIONAL (-1)
204+
#define WORKQ_HIGH_PRIOQUEUE_CONDITIONAL (-1)
205+
#else
206+
#define WORKQ_BG_PRIOQUEUE_CONDITIONAL WORKQ_BG_PRIOQUEUE
207+
#define WORKQ_HIGH_PRIOQUEUE_CONDITIONAL WORKQ_HIGH_PRIOQUEUE
208+
#endif
209+
202210
DISPATCH_CACHELINE_ALIGN
203211
static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
204212
[DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS] = {{{
@@ -226,7 +234,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
226234
[DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS] = {{{
227235
#if HAVE_PTHREAD_WORKQUEUES
228236
.dgq_qos = _DISPATCH_QOS_CLASS_BACKGROUND,
229-
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE,
237+
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE_CONDITIONAL,
230238
.dgq_wq_options = 0,
231239
#endif
232240
#if DISPATCH_ENABLE_THREAD_POOL
@@ -237,7 +245,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
237245
[DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS_OVERCOMMIT] = {{{
238246
#if HAVE_PTHREAD_WORKQUEUES
239247
.dgq_qos = _DISPATCH_QOS_CLASS_BACKGROUND,
240-
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE,
248+
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE_CONDITIONAL,
241249
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
242250
#endif
243251
#if DISPATCH_ENABLE_THREAD_POOL
@@ -314,7 +322,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
314322
[DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS] = {{{
315323
#if HAVE_PTHREAD_WORKQUEUES
316324
.dgq_qos = _DISPATCH_QOS_CLASS_USER_INTERACTIVE,
317-
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE,
325+
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE_CONDITIONAL,
318326
.dgq_wq_options = 0,
319327
#endif
320328
#if DISPATCH_ENABLE_THREAD_POOL
@@ -325,7 +333,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
325333
[DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS_OVERCOMMIT] = {{{
326334
#if HAVE_PTHREAD_WORKQUEUES
327335
.dgq_qos = _DISPATCH_QOS_CLASS_USER_INTERACTIVE,
328-
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE,
336+
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE_CONDITIONAL,
329337
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
330338
#endif
331339
#if DISPATCH_ENABLE_THREAD_POOL
@@ -810,7 +818,7 @@ _dispatch_root_queues_init_workq(void)
810818
dispatch_root_queue_context_t qc;
811819
qc = &_dispatch_root_queue_contexts[i];
812820
#if DISPATCH_USE_LEGACY_WORKQUEUE_FALLBACK
813-
if (!disable_wq) {
821+
if (!disable_wq && qc->dgq_wq_priority != -1) {
814822
r = pthread_workqueue_attr_setqueuepriority_np(&pwq_attr,
815823
qc->dgq_wq_priority);
816824
(void)dispatch_assume_zero(r);

src/shims/linux_stubs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,4 @@ unsigned short dispatch_timer__wake_semaphore;
101101
unsigned short dispatch_timer__fire_semaphore;
102102
unsigned short dispatch_timer__configure_semaphore;
103103
void (*_dispatch_block_special_invoke)(void*);
104+
struct dispatch_queue_attr_s _dispatch_queue_attr_concurrent;

0 commit comments

Comments
 (0)