summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2025-05-14 18:28:53 -0700
committerJohn Hawthorn <john@hawthorn.email>2025-05-20 09:56:31 -0700
commit05e0e7223acbc9ab223dd8f4b342d5eb6d3ae8c7 (patch)
tree15c3ed684845a6828e0935e87c6d90c2a3c46aec /thread.c
parentcd15cc250fa7dc6482833327728eeff641d2e41d (diff)
Use atomic load to read interrupt mask
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13357
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index 0494524510..dcd5a64f6b 100644
--- a/thread.c
+++ b/thread.c
@@ -2465,8 +2465,9 @@ threadptr_get_interrupts(rb_thread_t *th)
rb_atomic_t interrupt;
rb_atomic_t old;
+ old = ATOMIC_LOAD_RELAXED(ec->interrupt_flag);
do {
- interrupt = ec->interrupt_flag;
+ interrupt = old;
old = ATOMIC_CAS(ec->interrupt_flag, interrupt, interrupt & ec->interrupt_mask);
} while (old != interrupt);
return interrupt & (rb_atomic_t)~ec->interrupt_mask;