Skip to content

Commit 7a6f104

Browse files
committed
change various conditional code and data initializers from DISPATCH_ENABLE_THREAD_POOL to DISPATCH_USE_PTHREAD_POOL to avoid obvious segmentation violation due to missing dqg_ctxt initialization
1 parent e7ca00f commit 7a6f104

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/queue.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ struct dispatch_pthread_root_queue_context_s {
9898
typedef struct dispatch_pthread_root_queue_context_s *
9999
dispatch_pthread_root_queue_context_t;
100100

101-
#if DISPATCH_ENABLE_THREAD_POOL
101+
//#if DISPATCH_ENABLE_THREAD_POOL
102+
#if DISPATCH_USE_PTHREAD_POOL
102103
static struct dispatch_pthread_root_queue_context_s
103104
_dispatch_pthread_root_queue_contexts[] = {
104105
[DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS] = {
@@ -216,7 +217,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
216217
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE,
217218
.dgq_wq_options = 0,
218219
#endif
219-
#if DISPATCH_ENABLE_THREAD_POOL
220+
#if DISPATCH_USE_PTHREAD_POOL
220221
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
221222
DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS],
222223
#endif
@@ -227,7 +228,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
227228
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE,
228229
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
229230
#endif
230-
#if DISPATCH_ENABLE_THREAD_POOL
231+
#if DISPATCH_USE_PTHREAD_POOL
231232
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
232233
DISPATCH_ROOT_QUEUE_IDX_MAINTENANCE_QOS_OVERCOMMIT],
233234
#endif
@@ -238,7 +239,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
238239
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE_CONDITIONAL,
239240
.dgq_wq_options = 0,
240241
#endif
241-
#if DISPATCH_ENABLE_THREAD_POOL
242+
#if DISPATCH_USE_PTHREAD_POOL
242243
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
243244
DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS],
244245
#endif
@@ -249,7 +250,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
249250
.dgq_wq_priority = WORKQ_BG_PRIOQUEUE_CONDITIONAL,
250251
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
251252
#endif
252-
#if DISPATCH_ENABLE_THREAD_POOL
253+
#if DISPATCH_USE_PTHREAD_POOL
253254
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
254255
DISPATCH_ROOT_QUEUE_IDX_BACKGROUND_QOS_OVERCOMMIT],
255256
#endif
@@ -260,7 +261,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
260261
.dgq_wq_priority = WORKQ_LOW_PRIOQUEUE,
261262
.dgq_wq_options = 0,
262263
#endif
263-
#if DISPATCH_ENABLE_THREAD_POOL
264+
#if DISPATCH_USE_PTHREAD_POOL
264265
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
265266
DISPATCH_ROOT_QUEUE_IDX_UTILITY_QOS],
266267
#endif
@@ -271,9 +272,11 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
271272
.dgq_wq_priority = WORKQ_LOW_PRIOQUEUE,
272273
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
273274
#endif
274-
#if DISPATCH_ENABLE_THREAD_POOL
275+
#if DISPATCH_USE_PTHREAD_POOL
275276
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
276277
DISPATCH_ROOT_QUEUE_IDX_UTILITY_QOS_OVERCOMMIT],
278+
#else
279+
#error "bullshit"
277280
#endif
278281
}}},
279282
[DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS] = {{{
@@ -282,7 +285,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
282285
.dgq_wq_priority = WORKQ_DEFAULT_PRIOQUEUE,
283286
.dgq_wq_options = 0,
284287
#endif
285-
#if DISPATCH_ENABLE_THREAD_POOL
288+
#if DISPATCH_USE_PTHREAD_POOL
286289
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
287290
DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS],
288291
#endif
@@ -293,7 +296,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
293296
.dgq_wq_priority = WORKQ_DEFAULT_PRIOQUEUE,
294297
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
295298
#endif
296-
#if DISPATCH_ENABLE_THREAD_POOL
299+
#if DISPATCH_USE_PTHREAD_POOL
297300
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
298301
DISPATCH_ROOT_QUEUE_IDX_DEFAULT_QOS_OVERCOMMIT],
299302
#endif
@@ -304,7 +307,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
304307
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE,
305308
.dgq_wq_options = 0,
306309
#endif
307-
#if DISPATCH_ENABLE_THREAD_POOL
310+
#if DISPATCH_USE_PTHREAD_POOL
308311
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
309312
DISPATCH_ROOT_QUEUE_IDX_USER_INITIATED_QOS],
310313
#endif
@@ -315,7 +318,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
315318
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE,
316319
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
317320
#endif
318-
#if DISPATCH_ENABLE_THREAD_POOL
321+
#if DISPATCH_USE_PTHREAD_POOL
319322
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
320323
DISPATCH_ROOT_QUEUE_IDX_USER_INITIATED_QOS_OVERCOMMIT],
321324
#endif
@@ -326,7 +329,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
326329
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE_CONDITIONAL,
327330
.dgq_wq_options = 0,
328331
#endif
329-
#if DISPATCH_ENABLE_THREAD_POOL
332+
#if DISPATCH_USE_PTHREAD_POOL
330333
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
331334
DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS],
332335
#endif
@@ -337,7 +340,7 @@ static struct dispatch_root_queue_context_s _dispatch_root_queue_contexts[] = {
337340
.dgq_wq_priority = WORKQ_HIGH_PRIOQUEUE_CONDITIONAL,
338341
.dgq_wq_options = WORKQ_ADDTHREADS_OPTION_OVERCOMMIT,
339342
#endif
340-
#if DISPATCH_ENABLE_THREAD_POOL
343+
#if DISPATCH_USE_PTHREAD_POOL
341344
.dgq_ctxt = &_dispatch_pthread_root_queue_contexts[
342345
DISPATCH_ROOT_QUEUE_IDX_USER_INTERACTIVE_QOS_OVERCOMMIT],
343346
#endif

0 commit comments

Comments
 (0)