aboutsummaryrefslogtreecommitdiffstats
path: root/vm_core.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-17 07:28:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-17 07:28:53 +0000
commitdf62161d7e1e7e1878e6e4c834b61ebcc15b4f67 (patch)
tree42e2a28f442dd33225d824427208e25ec2276040 /vm_core.h
parentce7fdcf0f80dab0de42a2510a1d0d73e23dae535 (diff)
downloadruby-df62161d7e1e7e1878e6e4c834b61ebcc15b4f67.tar.gz
RUBY_VM_CHECK_INTS: eval the argument only once
* vm_core.h (RUBY_VM_CHECK_INTS): evaluate the argument only once to get rid of inadvertent side effects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/vm_core.h b/vm_core.h
index 5de066b883..4055e79d1d 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1090,11 +1090,14 @@ void rb_threadptr_pending_interrupt_clear(rb_thread_t *th);
void rb_threadptr_pending_interrupt_enque(rb_thread_t *th, VALUE v);
int rb_threadptr_pending_interrupt_active_p(rb_thread_t *th);
-#define RUBY_VM_CHECK_INTS(th) do { \
- if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) { \
- rb_threadptr_execute_interrupts(th, 0); \
- } \
-} while (0)
+#define RUBY_VM_CHECK_INTS(th) ruby_vm_check_ints(th)
+static inline void
+ruby_vm_check_ints(rb_thread_t *th)
+{
+ if (UNLIKELY(RUBY_VM_INTERRUPTED_ANY(th))) {
+ rb_threadptr_execute_interrupts(th, 0);
+ }
+}
/* tracer */
struct rb_trace_arg_struct {