diff options
author | Koichi Sasada <[email protected]> | 2020-12-02 03:37:56 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-12-07 08:28:36 +0900 |
commit | b67b24d0f5e78481e6a306881b6858f0dec996ba (patch) | |
tree | 178f1e37077ded7eb9bae6d2d2031a22a98f43f0 /vm_sync.h | |
parent | 60eabb1aa7d1d8ab83c49916bd8c3536daf5d03b (diff) |
ruby_single_main_ractor for single ractor mode
ruby_multi_ractor was a flag that indicates the interpreter doesn't
make any additional ractors (single ractor mode).
Instead of boolean flag, ruby_single_main_ractor pointer is introduced
which keeps main ractor's pointer if single ractor mode. If additional
ractors are created, ruby_single_main_ractor becomes NULL.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3842
Diffstat (limited to 'vm_sync.h')
-rw-r--r-- | vm_sync.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3,7 +3,6 @@ #define RUBY_VM_SYNC_H #include "vm_debug.h" -RUBY_EXTERN bool ruby_multi_ractor; #if USE_RUBY_DEBUG_LOG #define LOCATION_ARGS const char *file, int line @@ -29,10 +28,12 @@ void rb_vm_barrier(void); #include "vm_core.h" #endif +extern struct rb_ractor_struct *ruby_single_main_ractor; // ractor.c + static inline bool rb_multi_ractor_p(void) { - if (LIKELY(!ruby_multi_ractor)) { + if (LIKELY(ruby_single_main_ractor)) { // 0 on boot time. RUBY_ASSERT(GET_VM()->ractor.cnt <= 1); return false; |