https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=376fe1dab17791238f57fa6d071d3600651dead0
commit 376fe1dab17791238f57fa6d071d3600651dead0 Author: Corinna Vinschen <cori...@vinschen.de> AuthorDate: Fri Dec 6 19:41:35 2024 +0100 Commit: Corinna Vinschen <cori...@vinschen.de> CommitDate: Fri Dec 6 19:41:35 2024 +0100 Cygwin: cygthread: stop running all cygthreads at HIGHEST priority. Given the number of scenarios we're using cygthreads, it just doesn't make sense to run all of them with HIGHEST priority in preemptive obedience. Drop setting the cygthread priority and let the cygthreads decide by themselves. For the time being, run all cygthreads with normal priority. Change this locally in the thread function, if required. Signed-off-by: Corinna Vinschen <cori...@vinschen.de> Diff: --- winsup/cygwin/cygthread.cc | 5 ++++- winsup/cygwin/sigproc.cc | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/cygthread.cc b/winsup/cygwin/cygthread.cc index bd2ca55813f1..97df216b79c3 100644 --- a/winsup/cygwin/cygthread.cc +++ b/winsup/cygwin/cygthread.cc @@ -271,7 +271,10 @@ cygthread::async_create (ULONG_PTR arg) { cygthread *that = (cygthread *) arg; that->create (); - ::SetThreadPriority (that->h, THREAD_PRIORITY_HIGHEST); + /* We used to set the priority to HIGHEST here, but most cygthreads don't + require such a high priority. Keep the priority at NORMAL here and let + the thread function decide by itself if it needs a higher or lower + priority, based on the task it performs. */ that->zap_h (); } diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index c4c159578461..59b4208a6044 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -1345,7 +1345,6 @@ wait_sig (VOID *) hntdll = GetModuleHandle ("ntdll.dll"); - SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_NORMAL); for (;;) { DWORD nb;