diff --git a/patches/ntdll-NtAlertThreadByThreadId/0007-ntdll-Implement-thread-id-alerts-on-top-of-Mach-sema.patch b/patches/ntdll-NtAlertThreadByThreadId/0007-ntdll-Implement-thread-id-alerts-on-top-of-Mach-sema.patch index 32ae9a9e..d162fb3b 100644 --- a/patches/ntdll-NtAlertThreadByThreadId/0007-ntdll-Implement-thread-id-alerts-on-top-of-Mach-sema.patch +++ b/patches/ntdll-NtAlertThreadByThreadId/0007-ntdll-Implement-thread-id-alerts-on-top-of-Mach-sema.patch @@ -1,32 +1,32 @@ -From b281eaa388b6dc0c0c539cc76236a0529668fcff Mon Sep 17 00:00:00 2001 +From 4c58c278a16e77650b1a3626df6e43cb603089e2 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 31 Aug 2020 23:03:34 -0500 -Subject: [PATCH 07/13] ntdll: Implement thread-id alerts on top of Mach - semaphores on Mac. +Subject: [PATCH] ntdll: Implement thread-id alerts on top of Mach semaphores + on Mac. Signed-off-by: Zebediah Figura --- dlls/ntdll/unix/sync.c | 44 ++++++++++++++++++++++++++++++++++ dlls/ntdll/unix/thread.c | 4 ++++ - dlls/ntdll/unix/unix_private.h | 4 ++++ - 3 files changed, 52 insertions(+) + dlls/ntdll/unix/unix_private.h | 8 +++++++ + 3 files changed, 56 insertions(+) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c -index 3fd3545bbbb..e4aa03f94da 100644 +index 05a478ae464..377a34c0824 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c -@@ -2143,6 +2143,10 @@ NTSTATUS WINAPI NtAlertThreadByThreadId( HANDLE tid ) +@@ -2144,6 +2144,10 @@ NTSTATUS WINAPI NtAlertThreadByThreadId( HANDLE tid ) if (teb->ClientId.UniqueThread == tid) { pthread_rwlock_unlock( &teb_list_lock ); +#ifdef __APPLE__ -+ semaphore_signal( &thread_data->tid_alert_sem ); ++ semaphore_signal( thread_data->tid_alert_sem ); + return STATUS_SUCCESS; +#else #ifdef __linux__ if (use_futexes()) { -@@ -2154,6 +2158,7 @@ NTSTATUS WINAPI NtAlertThreadByThreadId( HANDLE tid ) +@@ -2155,6 +2159,7 @@ NTSTATUS WINAPI NtAlertThreadByThreadId( HANDLE tid ) #endif NtSetEvent( thread_data->tid_alert_event, NULL ); return STATUS_SUCCESS; @@ -34,7 +34,7 @@ index 3fd3545bbbb..e4aa03f94da 100644 } } -@@ -2191,6 +2196,44 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG +@@ -2192,6 +2197,44 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG { TRACE( "%p %s\n", address, debugstr_timeout( timeout ) ); @@ -61,7 +61,7 @@ index 3fd3545bbbb..e4aa03f94da 100644 + + timespec.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC; + timespec.tv_nsec = (timeleft % TICKSPERSEC) * 100; -+ ret = semaphore_timedwait( sem, ×pec ); ++ ret = semaphore_timedwait( sem, timespec ); + } + else + ret = semaphore_wait( sem ); @@ -79,7 +79,7 @@ index 3fd3545bbbb..e4aa03f94da 100644 #ifdef __linux__ if (use_futexes()) { -@@ -2226,6 +2269,7 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG +@@ -2227,6 +2270,7 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG } #endif return NtWaitForSingleObject( ntdll_get_thread_data()->tid_alert_event, FALSE, timeout ); @@ -104,10 +104,21 @@ index bb55b3d29ed..05157e24ace 100644 pthread_attr_init( &pthread_attr ); pthread_attr_setstack( &pthread_attr, teb->DeallocationStack, diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index 327e12519a0..9e94c0ec13c 100644 +index 7e733052c87..dc1c379c790 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -57,10 +57,14 @@ struct ntdll_thread_data +@@ -26,6 +26,10 @@ + #include "unixlib.h" + #include "wine/list.h" + ++#ifdef __APPLE__ ++# include ++#endif ++ + #ifdef __i386__ + static const enum cpu_type client_cpu = CPU_x86; + #elif defined(__x86_64__) +@@ -57,10 +61,14 @@ struct ntdll_thread_data struct list entry; /* entry in TEB list */ PRTL_THREAD_START_ROUTINE start; /* thread entry point */ void *param; /* thread entry point parameter */