From: Paul Gofman pgofman@codeweavers.com
--- dlls/ntdll/unix/sync.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index ae7bc115ffe..e070233104b 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -43,6 +43,9 @@ #ifdef HAVE_SCHED_H # include <sched.h> #endif +#ifdef HAVE_SYS_RESOURCE_H +# include <sys/resource.h> +#endif #include <string.h> #include <stdarg.h> #include <stdio.h> @@ -1514,7 +1517,17 @@ NTSTATUS WINAPI NtSignalAndWaitForSingleObject( HANDLE signal, HANDLE wait, NTSTATUS WINAPI NtYieldExecution(void) { #ifdef HAVE_SCHED_YIELD +#ifdef RUSAGE_THREAD + struct rusage u1, u2; + int ret; + + ret = getrusage( RUSAGE_THREAD, &u1 ); +#endif sched_yield(); +#ifdef RUSAGE_THREAD + if (!ret) ret = getrusage( RUSAGE_THREAD, &u2 ); + if (!ret && u1.ru_nvcsw == u2.ru_nvcsw && u1.ru_nivcsw == u2.ru_nivcsw) return STATUS_NO_YIELD_PERFORMED; +#endif return STATUS_SUCCESS; #else return STATUS_NO_YIELD_PERFORMED;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=144712
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:3875: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000031A00DA, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
Currently ThreadStore::SuspendAllThread in .Net core [1] may can take indefinite time to complete (I am reproducing that under certain conditions with Streets of Rage 4 game). The loop here tries to bring threads into specific internal state which involves suspending thread, and then if it stopped at wrong time resuming it and letting it work a little bit more. There are two problems on this way:
a. That's what this patch is fixing. Thread suspend and resume takes a long time on Wine and without some wait in suspending thread the thread doesn't advance anywhere between resume and next suspend. The linked code considers that SwitchToThread may do nothing on Windows (in fact, that is probably the case most of the time if there is nothing scheduled on the same core like on Linux) and does some wait but only if SwitchToThread correctly returned FALSE indicating that no yield was performed.
b. Another problem is in thread "hijacking" part which doesn't work at all currently with Wine because it relies on correct handling of CONTEXT_EXCEPTION_REQUEST / CONTEXT_EXCEPTION_REPORTING context flags in GetThreadContext(). That hits to much less extent as far as I could observe but also measurably slows down the operation. It is unrelated here, I am working on implementing that.
1. https://github.com/dotnet/corert/blob/c6af4cfc8b625851b91823d9be746c4f7abdc6...