4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-22 00:38:06 +08:00

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>
This commit is contained in:
Takashi Yano 2024-12-08 08:28:46 +09:00
parent 376fe1dab1
commit 0b6b450c64
4 changed files with 3 additions and 8 deletions

View File

@ -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;

View File

@ -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
{

View File

@ -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];

View File

@ -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