summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-11 14:27:08 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-11 14:27:08 +0000
commit9d4e471cf974d99ab01fc243b5419c6711888540 (patch)
tree531f8251fc433d165eb8a946cb9d6b6fad2aa7c0 /vm_core.h
parent8df20d6b169ed6b8e76927b5ce5db9acb0208a8b (diff)
* vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT,
RUBY_VM_SET_FINALIZER_INTERRUPT): use atomic ops for preventing interrupt_flag bit lost. * thread.c (rb_threadptr_execute_interrupts_rec): ditto. * vm_core.h (typedef struct rb_thread_struct): change type of interrupt_flag to rb_atomic_t. * atomic.h: move atomic ops definition from signal.c. * signal.c: remove atomic ops definition. * common.mk (gc, signal, thread, cont): add to dependency to atomic.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/vm_core.h b/vm_core.h
index f0bb86aedf..024b2ce68c 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -22,6 +22,7 @@
#include "vm_opts.h"
#include "id.h"
#include "method.h"
+#include "atomic.h"
#if defined(_WIN32)
#include "thread_win32.h"
@@ -430,7 +431,7 @@ typedef struct rb_thread_struct {
VALUE thrown_errinfo;
int exec_signal;
- int interrupt_flag;
+ rb_atomic_t interrupt_flag;
rb_thread_lock_t interrupt_lock;
struct rb_unblock_callback unblock;
VALUE locking_mutex;
@@ -686,9 +687,9 @@ extern rb_vm_t *ruby_current_vm;
#error "unsupported thread model"
#endif
-#define RUBY_VM_SET_INTERRUPT(th) ((th)->interrupt_flag |= 0x02)
-#define RUBY_VM_SET_TIMER_INTERRUPT(th) ((th)->interrupt_flag |= 0x01)
-#define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ((th)->interrupt_flag |= 0x04)
+#define RUBY_VM_SET_TIMER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x01)
+#define RUBY_VM_SET_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x02)
+#define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ATOMIC_OR((th)->interrupt_flag, 0x04)
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x02)
int rb_signal_buff_size(void);