Use atomic load to read interrupt mask

This commit is contained in:
John Hawthorn 2025-05-14 18:28:53 -07:00
parent cd15cc250f
commit 05e0e7223a
Notes: git 2025-05-20 17:00:21 +00:00
4 changed files with 25 additions and 9 deletions

View file

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