mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Use atomic load to read interrupt mask
This commit is contained in:
parent
cd15cc250f
commit
05e0e7223a
Notes:
git
2025-05-20 17:00:21 +00:00
4 changed files with 25 additions and 9 deletions
3
thread.c
3
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue