mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
ntdll-NtAlertThreadByThreadId: Reset a thread's Win32 futex entry when waking it.
Avoid a race where two simultaneous calls to RtlWakeAddressSingle() wake the same address.
This commit is contained in:
parent
d87ec36ccf
commit
dfddef9654
@ -1,4 +1,4 @@
|
||||
From 101957dbdaa322a7078e8ff49197e580a8b3a82c Mon Sep 17 00:00:00 2001
|
||||
From fb716c2886466b38ca0dcb5f993d66ef0dbb499e Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Mon, 2 Nov 2020 20:24:07 -0600
|
||||
Subject: [PATCH] ntdll: Reimplement Win32 futexes on top of thread-ID alerts.
|
||||
@ -6,12 +6,12 @@ Subject: [PATCH] ntdll: Reimplement Win32 futexes on top of thread-ID alerts.
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/ntdll/ntdll_misc.h | 2 +
|
||||
dlls/ntdll/sync.c | 154 ++++++++++++++++++++++++++++++++++++-
|
||||
dlls/ntdll/sync.c | 155 ++++++++++++++++++++++++++++++++++++-
|
||||
dlls/ntdll/thread.c | 2 +
|
||||
dlls/ntdll/unix/loader.c | 3 -
|
||||
dlls/ntdll/unix/sync.c | 162 ---------------------------------------
|
||||
dlls/ntdll/unixlib.h | 6 +-
|
||||
6 files changed, 156 insertions(+), 173 deletions(-)
|
||||
6 files changed, 157 insertions(+), 173 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
|
||||
index 41e8666a25c..8ba5c2e22fd 100644
|
||||
@ -27,7 +27,7 @@ index 41e8666a25c..8ba5c2e22fd 100644
|
||||
extern LCID user_lcid, system_lcid;
|
||||
extern DWORD ntdll_umbstowcs( const char* src, DWORD srclen, WCHAR* dst, DWORD dstlen ) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
|
||||
index 8df7015df9f..786289521e7 100644
|
||||
index 8df7015df9f..c3dfa0bcab1 100644
|
||||
--- a/dlls/ntdll/sync.c
|
||||
+++ b/dlls/ntdll/sync.c
|
||||
@@ -37,6 +37,13 @@
|
||||
@ -192,7 +192,7 @@ index 8df7015df9f..786289521e7 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -553,5 +684,22 @@ void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
@@ -553,5 +684,23 @@ void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
*/
|
||||
void WINAPI RtlWakeAddressSingle( const void *addr )
|
||||
{
|
||||
@ -208,7 +208,8 @@ index 8df7015df9f..786289521e7 100644
|
||||
+ {
|
||||
+ for (i = 0; i < ARRAY_SIZE(array->entries); ++i)
|
||||
+ {
|
||||
+ if (array->entries[i].addr == addr)
|
||||
+ if (array->entries[i].addr == addr
|
||||
+ && InterlockedCompareExchangePointer( &array->entries[i].addr, NULL, (void *)addr ) == addr)
|
||||
+ {
|
||||
+ NtAlertThreadByThreadId( array->entries[i].tid );
|
||||
+ return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user