aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Yano <takashi.yano@nifty.ne.jp>2024-12-08 08:28:46 +0900
committerTakashi Yano <takashi.yano@nifty.ne.jp>2024-12-08 08:58:27 +0900
commit0b6b450c64002dcdef09c10176ab181a17e09e52 (patch)
tree6759f31f07f7bbca2dfe3006fdaccd563c4fe408
parent376fe1dab17791238f57fa6d071d3600651dead0 (diff)
downloadnewlib-0b6b450c64002dcdef09c10176ab181a17e09e52.zip
newlib-0b6b450c64002dcdef09c10176ab181a17e09e52.tar.gz
newlib-0b6b450c64002dcdef09c10176ab181a17e09e52.tar.bz2
Cygwin: _cygtls: Remove _cygtls::spinning
There seems to be no rationale reason for _cygtls::spinning to exist, so it has been removed. _cygtls::spinning was introduced in the commit edc4f86ad282A, and this flag means that another thread is waiting to acquire _cygtls::stacklock. It is checked in the sig thread in _cygtls:: interrupt_now(), and if spinning is true, the interrupt will be delayed. However, in this case, _cygtls::incyg is also set, so it is supposed to be covered by _cygtls::incyg flag and does not seem to add any value. If some problems happen in the signal handling, it might be a good idea to revert this commit and check if the issue will be fixed. Reviewed-by: Corinna Vinschen <corinna@vinschen.de> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
-rw-r--r--winsup/cygwin/cygtls.cc2
-rw-r--r--winsup/cygwin/exceptions.cc5
-rw-r--r--winsup/cygwin/local_includes/cygtls.h1
-rwxr-xr-xwinsup/cygwin/scripts/gendef3
4 files changed, 3 insertions, 8 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
index 2842c27..bfaa198 100644
--- a/winsup/cygwin/cygtls.cc
+++ b/winsup/cygwin/cygtls.cc
@@ -81,7 +81,7 @@ _cygtls::fixup_after_fork ()
pop ();
current_sig = 0;
}
- stacklock = spinning = 0;
+ stacklock = 0;
signal_arrived = NULL;
locals.select.sockevt = NULL;
locals.cw_timer = NULL;
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 35a4a0b..4dc4be2 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -920,9 +920,8 @@ _cygtls::interrupt_now (CONTEXT *cx, siginfo_t& si, void *handler,
/* Delay the interrupt if we are
1) somehow inside the DLL
- 2) in _sigfe (spinning is true) and about to enter cygwin DLL
- 3) in a Windows DLL. */
- if (incyg || spinning || inside_kernel (cx))
+ 2) in a Windows DLL. */
+ if (incyg || inside_kernel (cx))
interrupted = false;
else
{
diff --git a/winsup/cygwin/local_includes/cygtls.h b/winsup/cygwin/local_includes/cygtls.h
index b7efcda..2d49064 100644
--- a/winsup/cygwin/local_includes/cygtls.h
+++ b/winsup/cygwin/local_includes/cygtls.h
@@ -196,7 +196,6 @@ public: /* Do NOT remove this public: line, it's a marker for gentls_offsets. */
waitq wq;
int current_sig;
unsigned incyg;
- volatile unsigned spinning;
volatile unsigned stacklock;
__tlsstack_t *stackptr;
__tlsstack_t stack[TLS_STACK_SIZE];
diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
index 11cdf58..5215501 100755
--- a/winsup/cygwin/scripts/gendef
+++ b/winsup/cygwin/scripts/gendef
@@ -134,7 +134,6 @@ _sigfe: # stack is aligned on entry!
movq %gs:8,%r10 # location of bottom of stack
1: movl \$1,%r11d
xchgl %r11d,_cygtls.stacklock(%r10) # try to acquire lock
- movl %r11d,_cygtls.spinning(%r10) # flag if we are waiting for lock
testl %r11d,%r11d # it will be zero
jz 2f # if so
pause
@@ -158,7 +157,6 @@ _sigbe: # return here after cygwin syscall
movq %gs:8,%r10 # address of bottom of tls
1: movl \$1,%r11d
xchgl %r11d,_cygtls.stacklock(%r10) # try to acquire lock
- movl %r11d,_cygtls.spinning(%r10) # flag if we are waiting for lock
testl %r11d,%r11d # it will be zero
jz 2f # if so
pause
@@ -258,7 +256,6 @@ sigdelayed:
1: movl \$1,%r11d
xchgl %r11d,_cygtls.stacklock(%r12) # try to acquire lock
- movl %r11d,_cygtls.spinning(%r12) # flag if we are waiting for lock
testl %r11d,%r11d # it will be zero
jz 2f # if so
pause