summaryrefslogtreecommitdiff
path: root/vm_sync.h
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-09-11 18:30:27 +0900
committerKoichi Sasada <ko1@atdot.net>2020-09-15 00:04:59 +0900
commit74ddac1c822697b442646f433d60e2c099db3c3b (patch)
tree12267700a22949057b28bbb348105f2a7a42fa74 /vm_sync.h
parentf7ccb8dd88c52b2294742c3abb87098ee4076799 (diff)
relax dependency
vm_sync.h does not need to include vm_core.h and ractor_pub.h.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3534
Diffstat (limited to 'vm_sync.h')
-rw-r--r--vm_sync.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/vm_sync.h b/vm_sync.h
index f601143416..2e174bf867 100644
--- a/vm_sync.h
+++ b/vm_sync.h
@@ -2,9 +2,8 @@
#ifndef RUBY_VM_SYNC_H
#define RUBY_VM_SYNC_H
-#include "vm_core.h"
#include "vm_debug.h"
-#include "ractor_pub.h"
+RUBY_EXTERN bool ruby_multi_ractor;
#if USE_RUBY_DEBUG_LOG
#define LOCATION_ARGS const char *file, int line
@@ -24,15 +23,18 @@ void rb_vm_unlock_body(LOCATION_ARGS);
void rb_vm_lock_enter_body(unsigned int *lev APPEND_LOCATION_ARGS);
void rb_vm_lock_leave_body(unsigned int *lev APPEND_LOCATION_ARGS);
void rb_vm_barrier(void);
-void rb_vm_cond_wait(rb_vm_t *vm, rb_nativethread_cond_t *cond);
-void rb_vm_cond_timedwait(rb_vm_t *vm, rb_nativethread_cond_t *cond, unsigned long msec);
+
+#if RUBY_DEBUG
+// GET_VM()
+#include "vm_core.h"
+#endif
static inline bool
rb_multi_ractor_p(void)
{
if (LIKELY(!ruby_multi_ractor)) {
// 0 on boot time.
- VM_ASSERT(GET_VM()->ractor.cnt <= 1);
+ RUBY_ASSERT(GET_VM()->ractor.cnt <= 1);
return false;
}
else {
@@ -84,7 +86,7 @@ rb_vm_lock_leave(unsigned int *lev, const char *file, int line)
#define RB_VM_LOCK_ENTER() { unsigned int _lev; RB_VM_LOCK_ENTER_LEV(&_lev);
#define RB_VM_LOCK_LEAVE() RB_VM_LOCK_LEAVE_LEV(&_lev); }
-#if VM_CHECK_MODE > 0
+#if RUBY_DEBUG > 0
void ASSERT_vm_locking(void);
void ASSERT_vm_unlocking(void);
#else