[PATCH 0/1] MR11722: ntdll: Treat 'reached_thread_count > total_thread_count' the same as equal in RtlBarrier().
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/ntdll/sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index e118cbee86a..ca6dd4a7d93 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -1457,7 +1457,7 @@ BOOLEAN WINAPI RtlBarrier( RTL_BARRIER *barrier, ULONG flags ) /* Wait for previous wait iteration to complete. */ count = 0; - while (ReadAcquire( &b->reached_thread_count ) == b->total_thread_count) + while (ReadAcquire( &b->reached_thread_count ) >= b->total_thread_count) { if (count < spin_count) { @@ -1469,7 +1469,7 @@ BOOLEAN WINAPI RtlBarrier( RTL_BARRIER *barrier, ULONG flags ) sizeof(b->reached_thread_count), NULL ); } InterlockedIncrement( &b->waiting_thread_count ); - if (InterlockedIncrement( &b->reached_thread_count ) == b->total_thread_count) + if (InterlockedIncrement( &b->reached_thread_count ) >= b->total_thread_count) { WriteRelease( &b->wait_barrier_complete, 1 ); RtlWakeAddressAll( (const void *)&b->wait_barrier_complete ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11722
That fixes a randomly failing tests on Wine at dlls/kernel32/tests/sync.c: line 3283. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11722#note_149476
participants (2)
-
Paul Gofman -
Paul Gofman (@gofman)