[newlib-cygwin/main] Cygwin: cygtls: add volatile qualifier to spinning

Corinna Vinschen corinna@sourceware.org
Thu Dec 5 23:49:36 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3a9fb7c561d9e8a78e444dd3920c57e857a92baa

commit 3a9fb7c561d9e8a78e444dd3920c57e857a92baa
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Thu Dec 5 21:15:13 2024 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Thu Dec 5 21:16:03 2024 +0100

    Cygwin: cygtls: add volatile qualifier to spinning
    
    Given that spinning is only checked once at the start of a
    _cygtls::interrupt_now() which is called in a loop, it's probably
    not necessary to mark _cygtls::spinning as volatile.
    
    However, spinning is changed from assembler code and we don't
    want the compiler to make funny assumptions, so, better safe than
    sorry.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/local_includes/cygtls.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/local_includes/cygtls.h b/winsup/cygwin/local_includes/cygtls.h
index efbd557b1ff0..b7efcdae2c46 100644
--- a/winsup/cygwin/local_includes/cygtls.h
+++ b/winsup/cygwin/local_includes/cygtls.h
@@ -196,7 +196,7 @@ public: /* Do NOT remove this public: line, it's a marker for gentls_offsets. */
   waitq wq;
   int current_sig;
   unsigned incyg;
-  unsigned spinning;
+  volatile unsigned spinning;
   volatile unsigned stacklock;
   __tlsstack_t *stackptr;
   __tlsstack_t stack[TLS_STACK_SIZE];


More information about the Cygwin-cvs mailing list