diff options
author | Koichi Sasada <[email protected]> | 2020-12-02 04:10:05 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-12-07 08:28:36 +0900 |
commit | 554a7180a0aad85bee5cb8ed41d99d16dab304e7 (patch) | |
tree | f0bb8a75d926265af53dd37ff01224560a41226a /vm_sync.h | |
parent | 23f9447429a1bbb262aa19afd9a2a1ad0eba8ca6 (diff) |
RB_VM_LOCK_ENTER_CR_LEV
This is variant of RB_VM_LOCK_ENTER_LEV, but accept current racotr's
pointer.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3842
Diffstat (limited to 'vm_sync.h')
-rw-r--r-- | vm_sync.h | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -19,6 +19,9 @@ bool rb_vm_locked_p(void); void rb_vm_lock_body(LOCATION_ARGS); void rb_vm_unlock_body(LOCATION_ARGS); + +struct rb_ractor_struct; +void rb_vm_lock_enter_body_cr(struct rb_ractor_struct *cr, unsigned int *lev APPEND_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); @@ -72,15 +75,29 @@ static inline void rb_vm_lock_leave(unsigned int *lev, const char *file, int line) { if (rb_multi_ractor_p()) { - rb_vm_lock_leave_body(lev APPEND_LOCATION_PARAMS); + rb_vm_lock_leave_body(lev APPEND_LOCATION_PARAMS); } } +static inline void +rb_vm_lock_enter_cr(struct rb_ractor_struct *cr, unsigned int *levp, const char *file, int line) +{ + rb_vm_lock_enter_body_cr(cr, levp APPEND_LOCATION_PARAMS); +} + +static inline void +rb_vm_lock_leave_cr(struct rb_ractor_struct *cr, unsigned int *levp, const char *file, int line) +{ + rb_vm_lock_leave_body(levp APPEND_LOCATION_PARAMS); +} + #define RB_VM_LOCKED_P() rb_vm_locked_p() #define RB_VM_LOCK() rb_vm_lock(__FILE__, __LINE__) #define RB_VM_UNLOCK() rb_vm_unlock(__FILE__, __LINE__) +#define RB_VM_LOCK_ENTER_CR_LEV(cr, levp) rb_vm_lock_enter_cr(cr, levp, __FILE__, __LINE__) +#define RB_VM_LOCK_LEAVE_CR_LEV(cr, levp) rb_vm_lock_leave_cr(cr, levp, __FILE__, __LINE__) #define RB_VM_LOCK_ENTER_LEV(levp) rb_vm_lock_enter(levp, __FILE__, __LINE__) #define RB_VM_LOCK_LEAVE_LEV(levp) rb_vm_lock_leave(levp, __FILE__, __LINE__) |