diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-11-29 16:58:05 +0900 |
---|---|---|
committer | Takashi Yano <takashi.yano@nifty.ne.jp> | 2024-12-04 00:03:43 +0900 |
commit | 9a274a967d1fe9a28d0d658749b08e65d09d3ee0 (patch) | |
tree | 9f16f0c02da9b1a83b379b275ca32080d7b6272d | |
parent | 2544e753963e9c15a9e3fe35188d8dea7b39d748 (diff) | |
download | newlib-9a274a967d1fe9a28d0d658749b08e65d09d3ee0.zip newlib-9a274a967d1fe9a28d0d658749b08e65d09d3ee0.tar.gz newlib-9a274a967d1fe9a28d0d658749b08e65d09d3ee0.tar.bz2 |
Cygwin: signal: Optimize the priority of the sig thread
Previously, the sig thread ran in THREAD_PRIORITY_HIGHEST priority.
This causes a critical delay in the signal handling in the main
thread if too many signals are received rapidly and the CPU is very
busy. In this case, most of the CPU time is allocated to the sig
thread, so the main thread cannot have a chance of handling signals.
With this patch, to avoid such a situation, the priority of the sig
thread is set to THREAD_PRIORITY_NORMAL priority.
Addresses: https://cygwin.com/pipermail/cygwin/2024-November/256744.html
Fixes: 53ad6f1394aa ("(cygthread::cygthread): Use three only arguments for detached threads, and start the thread via QueueUserAPC/async_create.")
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
-rw-r--r-- | winsup/cygwin/sigproc.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index decc7de..c74596f 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -1316,6 +1316,7 @@ wait_sig (VOID *) hntdll = GetModuleHandle ("ntdll.dll"); + SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_NORMAL); for (;;) { DWORD nb; |