Skip to content

Commit c675edc

Browse files
committed
resolve 1121 merge conflicts
This addresses the updates that were not applied to the Windows port but were applied to the Linux port and the macOS port.
1 parent 346785c commit c675edc

File tree

8 files changed

+34
-22
lines changed

8 files changed

+34
-22
lines changed

src/event/event_windows.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,20 @@ enum _dispatch_windows_port {
3232
#pragma mark dispatch_unote_t
3333

3434
bool
35-
_dispatch_unote_register(dispatch_unote_t du DISPATCH_UNUSED,
36-
dispatch_wlh_t wlh DISPATCH_UNUSED,
37-
dispatch_priority_t pri DISPATCH_UNUSED)
35+
_dispatch_unote_register_muxed(dispatch_unote_t du DISPATCH_UNUSED)
3836
{
3937
WIN_PORT_ERROR();
4038
return false;
4139
}
4240

4341
void
44-
_dispatch_unote_resume(dispatch_unote_t du DISPATCH_UNUSED)
42+
_dispatch_unote_resume_muxed(dispatch_unote_t du DISPATCH_UNUSED)
4543
{
4644
WIN_PORT_ERROR();
4745
}
4846

4947
bool
50-
_dispatch_unote_unregister(dispatch_unote_t du DISPATCH_UNUSED,
51-
uint32_t flags DISPATCH_UNUSED)
48+
_dispatch_unote_unregister_muxed(dispatch_unote_t du DISPATCH_UNUSED)
5249
{
5350
WIN_PORT_ERROR();
5451
return false;
@@ -102,8 +99,8 @@ _dispatch_timer_callback(PTP_CALLBACK_INSTANCE Instance, PVOID Context,
10299
}
103100

104101
void
105-
_dispatch_event_loop_timer_arm(uint32_t tidx,
106-
dispatch_timer_delay_s range,
102+
_dispatch_event_loop_timer_arm(dispatch_timer_heap_t dth DISPATCH_UNUSED,
103+
uint32_t tidx, dispatch_timer_delay_s range,
107104
dispatch_clock_now_cache_t nows)
108105
{
109106
dispatch_windows_timeout_t timer;
@@ -142,7 +139,8 @@ _dispatch_event_loop_timer_arm(uint32_t tidx,
142139
}
143140

144141
void
145-
_dispatch_event_loop_timer_delete(uint32_t tidx)
142+
_dispatch_event_loop_timer_delete(dispatch_timer_heap_t dth DISPATCH_UNUSED,
143+
uint32_t tidx)
146144
{
147145
dispatch_windows_timeout_t timer;
148146

@@ -238,6 +236,12 @@ _dispatch_event_loop_drain(uint32_t flags)
238236
}
239237
}
240238

239+
void
240+
_dispatch_event_loop_cancel_waiter(dispatch_sync_context_t dsc DISPATCH_UNUSED)
241+
{
242+
WIN_PORT_ERROR();
243+
}
244+
241245
void
242246
_dispatch_event_loop_wake_owner(dispatch_sync_context_t dsc,
243247
dispatch_wlh_t wlh, uint64_t old_state, uint64_t new_state)
@@ -269,9 +273,9 @@ _dispatch_event_loop_assert_not_owned(dispatch_wlh_t wlh)
269273
#endif
270274

271275
void
272-
_dispatch_event_loop_leave_immediate(dispatch_wlh_t wlh, uint64_t dq_state)
276+
_dispatch_event_loop_leave_immediate(uint64_t dq_state)
273277
{
274-
(void)wlh; (void)dq_state;
278+
(void)dq_state;
275279
}
276280

277281
#endif // DISPATCH_EVENT_BACKEND_WINDOWS

src/event/workqueue.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ _dispatch_workq_worker_register(dispatch_queue_global_t root_q)
9797
_dispatch_unfair_lock_unlock(&mon->registered_tid_lock);
9898
#else
9999
(void)root_q;
100-
(void)cls;
101100
#endif // HAVE_DISPATCH_WORKQ_MONITORING
102101
}
103102

@@ -124,7 +123,6 @@ _dispatch_workq_worker_unregister(dispatch_queue_global_t root_q)
124123
_dispatch_unfair_lock_unlock(&mon->registered_tid_lock);
125124
#else
126125
(void)root_q;
127-
(void)cls;
128126
#endif // HAVE_DISPATCH_WORKQ_MONITORING
129127
}
130128

src/io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,11 +1399,11 @@ _dispatch_fd_entry_create_with_fd(dispatch_fd_t fd, uintptr_t hash)
13991399
int result = ioctlsocket((SOCKET)fd, (long)FIONBIO, &value);
14001400
(void)dispatch_assume_zero(result);
14011401
_dispatch_stream_init(fd_entry,
1402-
_dispatch_get_root_queue(DISPATCH_QOS_DEFAULT, false));
1402+
_dispatch_get_default_queue(false));
14031403
} else {
14041404
dispatch_suspend(fd_entry->barrier_queue);
1405-
dispatch_once_f(&_dispatch_io_devs_lockq_pred, NULL,
1406-
_dispatch_io_devs_lockq_init);
1405+
dispatch_once_f(&_dispatch_io_init_pred, NULL,
1406+
_dispatch_io_queues_init);
14071407
dispatch_async(_dispatch_io_devs_lockq, ^{
14081408
_dispatch_disk_init(fd_entry, 0);
14091409
dispatch_resume(fd_entry->barrier_queue);

src/queue.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4055,6 +4055,7 @@ static const struct dispatch_queue_global_s _dispatch_custom_workloop_root_queue
40554055
static void
40564056
_dispatch_workloop_activate_attributes(dispatch_workloop_t dwl)
40574057
{
4058+
#if defined(_POSIX_THREADS)
40584059
dispatch_workloop_attr_t dwla = dwl->dwl_attr;
40594060
pthread_attr_t attr;
40604061

@@ -4082,7 +4083,7 @@ _dispatch_workloop_activate_attributes(dispatch_workloop_t dwl)
40824083
(unsigned long)dwla->dwla_cpupercent.refillms);
40834084
}
40844085
#endif // HAVE_PTHREAD_ATTR_SETCPUPERCENT_NP
4085-
#if TARGET_OS_MAC
4086+
#if TARGET_OS_MAC
40864087
if (_dispatch_workloop_has_kernel_attributes(dwl)) {
40874088
int rv = _pthread_workloop_create((uint64_t)dwl, 0, &attr);
40884089
switch (rv) {
@@ -4099,6 +4100,7 @@ _dispatch_workloop_activate_attributes(dispatch_workloop_t dwl)
40994100
}
41004101
#endif // TARGET_OS_MAC
41014102
pthread_attr_destroy(&attr);
4103+
#endif // defined(_POSIX_THREADS)
41024104
}
41034105

41044106
void
@@ -5679,7 +5681,9 @@ static void
56795681
_dispatch_root_queue_poke_slow(dispatch_queue_global_t dq, int n, int floor)
56805682
{
56815683
int remaining = n;
5684+
#if !defined(_WIN32)
56825685
int r = ENOSYS;
5686+
#endif
56835687

56845688
_dispatch_root_queues_init();
56855689
_dispatch_debug_root_queue(dq, __func__);
@@ -5777,9 +5781,11 @@ _dispatch_root_queue_poke_slow(dispatch_queue_global_t dq, int n, int floor)
57775781
}
57785782
_dispatch_temporary_resource_shortage();
57795783
}
5784+
#if DISPATCH_USE_PTHREAD_ROOT_QUEUES
57805785
if (_dispatch_mgr_sched.prio > _dispatch_mgr_sched.default_prio) {
57815786
(void)dispatch_assume_zero(SetThreadPriority((HANDLE)hThread, _dispatch_mgr_sched.prio) == TRUE);
57825787
}
5788+
#endif
57835789
CloseHandle((HANDLE)hThread);
57845790
} while (--remaining);
57855791
#endif // defined(_WIN32)

src/shims/generic_win_stubs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ typedef __typeof__(_Generic((__SIZE_TYPE__)0, \
3434
#define WIN_PORT_ERROR() \
3535
_RPTF1(_CRT_ASSERT, "WIN_PORT_ERROR in %s", __FUNCTION__)
3636

37+
#define strcasecmp _stricmp
38+
3739
#endif

src/shims/lock.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ _dispatch_wait_on_address(uint32_t volatile *_address, uint32_t value,
508508
}
509509
return _dispatch_futex_wait(address, value, NULL, FUTEX_PRIVATE_FLAG);
510510
#elif defined(_WIN32)
511-
WaitOnAddress(address, &value, sizeof(value), INFINITE);
511+
return WaitOnAddress(address, &value, sizeof(value), INFINITE) == TRUE;
512512
#else
513513
#error _dispatch_wait_on_address unimplemented for this platform
514514
#endif
@@ -651,7 +651,9 @@ _dispatch_once_wait(dispatch_once_gate_t dgo)
651651
{
652652
dispatch_lock self = _dispatch_lock_value_for_self();
653653
uintptr_t old_v, new_v;
654+
#if HAVE_UL_UNFAIR_LOCK || HAVE_FUTEX
654655
dispatch_lock *lock = &dgo->dgo_gate.dgl_lock;
656+
#endif
655657
uint32_t timeout = 1;
656658

657659
for (;;) {
@@ -680,7 +682,7 @@ _dispatch_once_wait(dispatch_once_gate_t dgo)
680682
_dispatch_futex_wait(lock, (dispatch_lock)new_v, NULL,
681683
FUTEX_PRIVATE_FLAG);
682684
#else
683-
_dispatch_thread_switch(new_v, flags, timeout++);
685+
_dispatch_thread_switch(new_v, 0, timeout++);
684686
#endif
685687
(void)timeout;
686688
}

src/shims/yield.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ void *_dispatch_wait_for_enqueuer(void **ptr);
154154
#define _dispatch_preemption_yield(n) { (void)n; pthread_yield_np(); }
155155
#define _dispatch_preemption_yield_to(th, n) { (void)n; pthread_yield_np(); }
156156
#elif defined(_WIN32)
157-
#define _dispatch_preemption_yield(n) { (void)n; sched_yield(); }
158-
#define _dispatch_preemption_yield_to(th, n) { (void)n; sched_yield(); }
157+
#define _dispatch_preemption_yield(n) { (void)n; Sleep(0); }
158+
#define _dispatch_preemption_yield_to(th, n) { (void)n; Sleep(0); }
159159
#else
160160
#define _dispatch_preemption_yield(n) { (void)n; pthread_yield(); }
161161
#define _dispatch_preemption_yield_to(th, n) { (void)n; pthread_yield(); }

src/source.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ dispatch_source_get_extended_data(dispatch_source_t ds,
197197
}
198198

199199
void
200-
dispatch_source_merge_data(dispatch_source_t ds, unsigned long val)
200+
dispatch_source_merge_data(dispatch_source_t ds, uintptr_t val)
201201
{
202202
dispatch_queue_flags_t dqf = _dispatch_queue_atomic_flags(ds);
203203
dispatch_source_refs_t dr = ds->ds_refs;

0 commit comments

Comments
 (0)