Skip to content

Commit bde13a1

Browse files
committed
Linux build fixes
define WORKQ_ADDTHREADS_OPTION_OVERCOMMIT for DISPATCH_USE_INTERNAL_WORKQUEUE remove unused _swift_dispatch_apply_current_root_queue symbol remove duplicate _dispatch_adopt_wlh_anon() in _dispatch_mgr_thread(), this is already set by its caller _dispatch_root_queue_drain() Signed-off-by: Daniel A. Steffen <[email protected]>
1 parent fba90ce commit bde13a1

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/event/workqueue_internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
#define WORKQ_NUM_PRIORITIES 6
3939

40+
#define WORKQ_ADDTHREADS_OPTION_OVERCOMMIT 0x1
41+
4042
#define DISPATCH_WORKQ_MAX_PTHREAD_COUNT 255
4143

4244
void _dispatch_workq_worker_register(dispatch_queue_t root_q, int priority);

src/internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void _dispatch_log(const char *msg, ...);
454454
* For reporting bugs within libdispatch when using the "_debug" version of the
455455
* library.
456456
*/
457-
#if __GNUC__
457+
#if __APPLE__
458458
#define dispatch_assert(e) do { \
459459
if (__builtin_constant_p(e)) { \
460460
dispatch_static_assert(e); \
@@ -472,7 +472,7 @@ static inline void _dispatch_assert(long e, long line) {
472472
#define dispatch_assert(e) _dispatch_assert((long)(e), __LINE__)
473473
#endif /* __GNUC__ */
474474

475-
#if __GNUC__
475+
#if __APPLE__
476476
/*
477477
* A lot of API return zero upon success and not-zero on fail. Let's capture
478478
* and log the non-zero value
@@ -491,7 +491,7 @@ static inline void _dispatch_assert(long e, long line) {
491491
static inline void _dispatch_assert_zero(long e, long line) {
492492
if (DISPATCH_DEBUG && e) _dispatch_abort(line, e);
493493
}
494-
#define dispatch_assert_zero(e) _dispatch_assert((long)(e), __LINE__)
494+
#define dispatch_assert_zero(e) _dispatch_assert_zero((long)(e), __LINE__)
495495
#endif /* __GNUC__ */
496496

497497
/*

src/queue.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4523,10 +4523,12 @@ _dispatch_return_to_kernel(void)
45234523
void
45244524
_dispatch_poll_for_events_4launchd(void)
45254525
{
4526+
#if DISPATCH_USE_KEVENT_WORKQUEUE
45264527
if (_dispatch_get_wlh()) {
45274528
dispatch_assert(_dispatch_deferred_items_get()->ddi_wlh_servicing);
45284529
_dispatch_event_loop_drain(KEVENT_FLAG_IMMEDIATE);
45294530
}
4531+
#endif
45304532
}
45314533

45324534
#if HAVE_PTHREAD_WORKQUEUE_NARROWING

src/shims/lock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,9 +601,9 @@ _dispatch_gate_wait_slow(dispatch_gate_t dgl, dispatch_lock value,
601601
#if HAVE_UL_UNFAIR_LOCK
602602
_dispatch_unfair_lock_wait(&dgl->dgl_lock, new_value, 0, flags);
603603
#elif HAVE_FUTEX
604-
_dispatch_futex_wait(&dgl->dgl_lock, tid_new, NULL, FUTEX_PRIVATE_FLAG);
604+
_dispatch_futex_wait(&dgl->dgl_lock, new_value, NULL, FUTEX_PRIVATE_FLAG);
605605
#else
606-
_dispatch_thread_switch(tid_new, flags, timeout++);
606+
_dispatch_thread_switch(new_value, flags, timeout++);
607607
#endif
608608
(void)timeout;
609609
}

src/source.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,6 @@ _dispatch_mgr_thread(dispatch_queue_t dq DISPATCH_UNUSED,
23212321
}
23222322
#endif
23232323
#if DISPATCH_USE_MGR_THREAD
2324-
_dispatch_adopt_wlh_anon();
23252324
_dispatch_queue_set_current(&_dispatch_mgr_q);
23262325
_dispatch_mgr_priority_init();
23272326
_dispatch_queue_mgr_lock(&_dispatch_mgr_q);

src/swift/Queue.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,5 @@ internal func _swift_dispatch_queue_concurrent() -> dispatch_queue_attr_t
344344
@_silgen_name("_swift_dispatch_get_main_queue")
345345
internal func _swift_dispatch_get_main_queue() -> dispatch_queue_t
346346

347-
@_silgen_name("_swift_dispatch_apply_current_root_queue")
348-
internal func _swift_dispatch_apply_current_root_queue() -> dispatch_queue_t
349-
350347
@_silgen_name("_swift_dispatch_apply_current")
351348
internal func _swift_dispatch_apply_current(_ iterations: Int, _ block: @convention(block) (Int) -> Void)

0 commit comments

Comments
 (0)