mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-01-28 22:04:43 -08:00
Rebase against 80a30625a70343cf6f38d80d02f640d684e27e6d.
This commit is contained in:
parent
9a5667dba1
commit
5f113860f5
File diff suppressed because it is too large
Load Diff
@ -1,209 +0,0 @@
|
||||
From 2cecfc6394a63db07b92c572d0702cf2a8bf0f31 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Thu, 9 Jan 2020 14:51:05 -0600
|
||||
Subject: [PATCH] ntdll/tests: Add some tests for Rtl* resources.
|
||||
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
---
|
||||
dlls/ntdll/tests/sync.c | 164 ++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 164 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/sync.c b/dlls/ntdll/tests/sync.c
|
||||
index 3d6b6a3a04d..21124dae922 100644
|
||||
--- a/dlls/ntdll/tests/sync.c
|
||||
+++ b/dlls/ntdll/tests/sync.c
|
||||
@@ -44,7 +44,12 @@ static NTSTATUS (WINAPI *pNtReleaseSemaphore)( HANDLE, ULONG, ULONG * );
|
||||
static NTSTATUS (WINAPI *pNtResetEvent)( HANDLE, LONG * );
|
||||
static NTSTATUS (WINAPI *pNtSetEvent)( HANDLE, LONG * );
|
||||
static NTSTATUS (WINAPI *pNtWaitForKeyedEvent)( HANDLE, const void *, BOOLEAN, const LARGE_INTEGER * );
|
||||
+static BOOLEAN (WINAPI *pRtlAcquireResourceExclusive)( RTL_RWLOCK *, BOOLEAN );
|
||||
+static BOOLEAN (WINAPI *pRtlAcquireResourceShared)( RTL_RWLOCK *, BOOLEAN );
|
||||
+static void (WINAPI *pRtlDeleteResource)( RTL_RWLOCK * );
|
||||
+static void (WINAPI *pRtlInitializeResource)( RTL_RWLOCK * );
|
||||
static void (WINAPI *pRtlInitUnicodeString)( UNICODE_STRING *, const WCHAR * );
|
||||
+static void (WINAPI *pRtlReleaseResource)( RTL_RWLOCK * );
|
||||
static NTSTATUS (WINAPI *pRtlWaitOnAddress)( const void *, const void *, SIZE_T, const LARGE_INTEGER * );
|
||||
static void (WINAPI *pRtlWakeAddressAll)( const void * );
|
||||
static void (WINAPI *pRtlWakeAddressSingle)( const void * );
|
||||
@@ -595,6 +600,159 @@ static void test_wait_on_address(void)
|
||||
ok(address == 0, "got %s\n", wine_dbgstr_longlong(address));
|
||||
}
|
||||
|
||||
+static HANDLE thread_ready, thread_done;
|
||||
+
|
||||
+static DWORD WINAPI resource_shared_thread(void *arg)
|
||||
+{
|
||||
+ RTL_RWLOCK *resource = arg;
|
||||
+ BOOLEAN ret;
|
||||
+
|
||||
+ ret = pRtlAcquireResourceShared(resource, TRUE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+
|
||||
+ SetEvent(thread_ready);
|
||||
+ ok(!WaitForSingleObject(thread_done, 1000), "wait failed\n");
|
||||
+ pRtlReleaseResource(resource);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static DWORD WINAPI resource_exclusive_thread(void *arg)
|
||||
+{
|
||||
+ RTL_RWLOCK *resource = arg;
|
||||
+ BOOLEAN ret;
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(resource, TRUE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+
|
||||
+ SetEvent(thread_ready);
|
||||
+ ok(!WaitForSingleObject(thread_done, 1000), "wait failed\n");
|
||||
+ pRtlReleaseResource(resource);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void test_resource(void)
|
||||
+{
|
||||
+ HANDLE thread, thread2;
|
||||
+ RTL_RWLOCK resource;
|
||||
+ BOOLEAN ret;
|
||||
+
|
||||
+ pRtlInitializeResource(&resource);
|
||||
+ thread_ready = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
+ thread_done = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
+
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == FALSE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ /* Do not acquire the resource ourselves, but spawn a shared thread holding it. */
|
||||
+
|
||||
+ thread = CreateThread(NULL, 0, resource_shared_thread, &resource, 0, NULL);
|
||||
+ ok(!WaitForSingleObject(thread_ready, 1000), "wait failed\n");
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == FALSE, "got %u\n", ret);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ SetEvent(thread_done);
|
||||
+ ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
|
||||
+ CloseHandle(thread);
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ /* Acquire the resource as exclusive, and then spawn a shared thread. */
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ thread = CreateThread(NULL, 0, resource_shared_thread, &resource, 0, NULL);
|
||||
+ ok(WaitForSingleObject(thread_ready, 100) == WAIT_TIMEOUT, "expected timeout\n");
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ ok(!WaitForSingleObject(thread_ready, 1000), "wait failed\n");
|
||||
+ SetEvent(thread_done);
|
||||
+ ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
|
||||
+ CloseHandle(thread);
|
||||
+
|
||||
+ /* Acquire the resource as shared, and then spawn an exclusive thread. */
|
||||
+
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ thread = CreateThread(NULL, 0, resource_exclusive_thread, &resource, 0, NULL);
|
||||
+ ok(WaitForSingleObject(thread_ready, 100) == WAIT_TIMEOUT, "expected timeout\n");
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == FALSE, "got %u\n", ret);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ ok(!WaitForSingleObject(thread_ready, 1000), "wait failed\n");
|
||||
+ SetEvent(thread_done);
|
||||
+ ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
|
||||
+ CloseHandle(thread);
|
||||
+
|
||||
+ /* Spawn a shared and then exclusive waiter. */
|
||||
+ thread = CreateThread(NULL, 0, resource_shared_thread, &resource, 0, NULL);
|
||||
+ ok(!WaitForSingleObject(thread_ready, 1000), "wait failed\n");
|
||||
+ thread2 = CreateThread(NULL, 0, resource_exclusive_thread, &resource, 0, NULL);
|
||||
+ ok(WaitForSingleObject(thread_ready, 100) == WAIT_TIMEOUT, "expected timeout\n");
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == FALSE, "got %u\n", ret);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ SetEvent(thread_done);
|
||||
+ ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
|
||||
+ CloseHandle(thread);
|
||||
+
|
||||
+ ok(!WaitForSingleObject(thread_ready, 1000), "wait failed\n");
|
||||
+ SetEvent(thread_done);
|
||||
+ ok(!WaitForSingleObject(thread2, 1000), "wait failed\n");
|
||||
+ CloseHandle(thread2);
|
||||
+
|
||||
+ ret = pRtlAcquireResourceExclusive(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+ ret = pRtlAcquireResourceShared(&resource, FALSE);
|
||||
+ ok(ret == TRUE, "got %u\n", ret);
|
||||
+ pRtlReleaseResource(&resource);
|
||||
+
|
||||
+ CloseHandle(thread_ready);
|
||||
+ CloseHandle(thread_done);
|
||||
+ pRtlDeleteResource(&resource);
|
||||
+}
|
||||
+
|
||||
START_TEST(sync)
|
||||
{
|
||||
HMODULE module = GetModuleHandleA("ntdll.dll");
|
||||
@@ -617,7 +775,12 @@ START_TEST(sync)
|
||||
pNtResetEvent = (void *)GetProcAddress(module, "NtResetEvent");
|
||||
pNtSetEvent = (void *)GetProcAddress(module, "NtSetEvent");
|
||||
pNtWaitForKeyedEvent = (void *)GetProcAddress(module, "NtWaitForKeyedEvent");
|
||||
+ pRtlAcquireResourceExclusive = (void *)GetProcAddress(module, "RtlAcquireResourceExclusive");
|
||||
+ pRtlAcquireResourceShared = (void *)GetProcAddress(module, "RtlAcquireResourceShared");
|
||||
+ pRtlDeleteResource = (void *)GetProcAddress(module, "RtlDeleteResource");
|
||||
+ pRtlInitializeResource = (void *)GetProcAddress(module, "RtlInitializeResource");
|
||||
pRtlInitUnicodeString = (void *)GetProcAddress(module, "RtlInitUnicodeString");
|
||||
+ pRtlReleaseResource = (void *)GetProcAddress(module, "RtlReleaseResource");
|
||||
pRtlWaitOnAddress = (void *)GetProcAddress(module, "RtlWaitOnAddress");
|
||||
pRtlWakeAddressAll = (void *)GetProcAddress(module, "RtlWakeAddressAll");
|
||||
pRtlWakeAddressSingle = (void *)GetProcAddress(module, "RtlWakeAddressSingle");
|
||||
@@ -627,4 +790,5 @@ START_TEST(sync)
|
||||
test_mutant();
|
||||
test_semaphore();
|
||||
test_keyed_events();
|
||||
+ test_resource();
|
||||
}
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 41d56b3e16cbe1dd59b19eee9faf0d6b3ec9bf8f Mon Sep 17 00:00:00 2001
|
||||
From c83cd4d1151d182c3ae35f87b20b6ba30cf24316 Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Mon, 7 Jun 2021 16:26:18 -0500
|
||||
Subject: [PATCH] ntdll: Reimplement Win32 futexes on top of thread-ID alerts.
|
||||
@ -6,34 +6,36 @@ Subject: [PATCH] ntdll: Reimplement Win32 futexes on top of thread-ID alerts.
|
||||
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
|
||||
---
|
||||
dlls/ntdll/sync.c | 215 ++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/ntdll/sync.c | 214 ++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/ntdll/unix/loader.c | 3 -
|
||||
dlls/ntdll/unix/sync.c | 162 -----------------------------
|
||||
dlls/ntdll/unixlib.h | 6 +-
|
||||
4 files changed, 213 insertions(+), 173 deletions(-)
|
||||
4 files changed, 212 insertions(+), 173 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
|
||||
index f1263ae33fd..c0a6e3a729e 100644
|
||||
index bfb30661864..db68a466d8a 100644
|
||||
--- a/dlls/ntdll/sync.c
|
||||
+++ b/dlls/ntdll/sync.c
|
||||
@@ -34,8 +34,16 @@
|
||||
@@ -34,11 +34,18 @@
|
||||
#include "windef.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/debug.h"
|
||||
+#include "wine/list.h"
|
||||
#include "ntdll_misc.h"
|
||||
|
||||
+WINE_DEFAULT_DEBUG_CHANNEL(sync);
|
||||
+
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(sync);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(relay);
|
||||
|
||||
+static const char *debugstr_timeout( const LARGE_INTEGER *timeout )
|
||||
+{
|
||||
+ if (!timeout) return "(infinite)";
|
||||
+ return wine_dbgstr_longlong( timeout->QuadPart );
|
||||
+}
|
||||
|
||||
+
|
||||
/******************************************************************
|
||||
* RtlRunOnceInitialize (NTDLL.@)
|
||||
@@ -530,13 +538,142 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
|
||||
*/
|
||||
@@ -863,13 +870,142 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -177,7 +179,7 @@ index f1263ae33fd..c0a6e3a729e 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -544,7 +681,42 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
|
||||
@@ -877,7 +1013,42 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
|
||||
*/
|
||||
void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
{
|
||||
@ -221,7 +223,7 @@ index f1263ae33fd..c0a6e3a729e 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -552,5 +724,42 @@ void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
@@ -885,5 +1056,42 @@ void WINAPI RtlWakeAddressAll( const void *addr )
|
||||
*/
|
||||
void WINAPI RtlWakeAddressSingle( const void *addr )
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "e73bb07ff59d0d0b7925df3d642299689275b0a8"
|
||||
echo "80a30625a70343cf6f38d80d02f640d684e27e6d"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -2455,20 +2455,15 @@ fi
|
||||
# | * [#50292] Process-local synchronization objects use private interfaces into the Unix library
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/ntdll/Makefile.in, dlls/ntdll/critsection.c, dlls/ntdll/ntdll.spec, dlls/ntdll/sync.c,
|
||||
# | dlls/ntdll/tests/Makefile.in, dlls/ntdll/tests/om.c, dlls/ntdll/tests/sync.c, dlls/ntdll/unix/loader.c,
|
||||
# | dlls/ntdll/unix/sync.c, dlls/ntdll/unix/unix_private.h, dlls/ntdll/unixlib.h, dlls/wow64/sync.c, dlls/wow64/syscall.h,
|
||||
# | include/winternl.h
|
||||
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/sync.c, dlls/ntdll/tests/sync.c, dlls/ntdll/unix/loader.c, dlls/ntdll/unix/sync.c,
|
||||
# | dlls/ntdll/unix/unix_private.h, dlls/ntdll/unixlib.h, dlls/wow64/sync.c, dlls/wow64/syscall.h, include/winternl.h
|
||||
# |
|
||||
if test "$enable_ntdll_NtAlertThreadByThreadId" -eq 1; then
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0001-ntdll-tests-Move-some-tests-to-a-new-sync.c-file.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0002-ntdll-tests-Add-some-tests-for-Rtl-resources.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0003-ntdll-Implement-NtAlertThreadByThreadId-and-NtWaitFo.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0004-ntdll-tests-Add-basic-tests-for-thread-id-alert-func.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0005-ntdll-Implement-thread-ID-alerts-using-futexes-if-po.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0006-ntdll-Implement-thread-ID-alerts-using-Mach-semaphor.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0007-ntdll-Reimplement-Win32-futexes-on-top-of-thread-ID-.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0008-ntdll-Merge-critsection.c-into-sync.c.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0009-ntdll-Reimplement-the-critical-section-fast-path-on-.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0010-ntdll-Get-rid-of-the-direct-futex-path-for-condition.patch
|
||||
patch_apply ntdll-NtAlertThreadByThreadId/0011-ntdll-Reimplement-SRW-locks-on-top-of-Win32-futexes.patch
|
||||
|
@ -1 +1 @@
|
||||
e73bb07ff59d0d0b7925df3d642299689275b0a8
|
||||
80a30625a70343cf6f38d80d02f640d684e27e6d
|
||||
|
Loading…
x
Reference in New Issue
Block a user