Ruby: vm_sync.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions | Variables
vm_sync.h File Reference
`#include "vm_debug.h"`
`#include "debug_counter.h"`

Go to the source code of this file.

## Macros
#define | LOCATION_ARGS void
#define | LOCATION_PARAMS
#define | APPEND_LOCATION_ARGS
#define | 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__)
#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); }
#define | RB_VM_LOCK_ENTER_LEV_NB(levp) rb_vm_lock_enter_nb(levp, __FILE__, __LINE__)
#define | RB_VM_LOCK_ENTER_NO_BARRIER() { unsigned int _lev; RB_VM_LOCK_ENTER_LEV_NB(&_lev);
#define | RB_VM_LOCK_LEAVE_NO_BARRIER() RB_VM_LOCK_LEAVE_LEV(&_lev); }
#define | ASSERT_vm_locking()
#define | ASSERT_vm_unlocking()

## Functions
bool | rb_vm_locked_p (void)
void | rb_vm_lock_body (LOCATION_ARGS)
void | rb_vm_unlock_body (LOCATION_ARGS)
void | rb_vm_lock_enter_body_cr (struct rb_ractor_struct *cr, unsigned int *lev APPEND_LOCATION_ARGS)
void | rb_vm_lock_enter_body_nb (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)

## Variables
struct rb_ractor_struct * | ruby_single_main_ractor

## Macro Definition Documentation

## ◆ APPEND_LOCATION_ARGS

#define APPEND_LOCATION_ARGS

Definition at line 16 of file vm_sync.h.

## ◆ APPEND_LOCATION_PARAMS

#define APPEND_LOCATION_PARAMS

Definition at line 17 of file vm_sync.h.

## ◆ ASSERT_vm_locking

#define ASSERT_vm_locking | ( |  | ) |

Definition at line 134 of file vm_sync.h.

## ◆ ASSERT_vm_unlocking

#define ASSERT_vm_unlocking | ( |  | ) |

Definition at line 135 of file vm_sync.h.

## ◆ LOCATION_ARGS

#define LOCATION_ARGS void

Definition at line 14 of file vm_sync.h.

## ◆ LOCATION_PARAMS

#define LOCATION_PARAMS

Definition at line 15 of file vm_sync.h.

## ◆ RB_VM_LOCK

#define RB_VM_LOCK | ( |  | ) | rb_vm_lock(__FILE__, __LINE__)

Definition at line 113 of file vm_sync.h.

## ◆ RB_VM_LOCK_ENTER

#define RB_VM_LOCK_ENTER | ( |  | ) | { unsigned int _lev; RB_VM_LOCK_ENTER_LEV(&_lev);

Definition at line 121 of file vm_sync.h.

## ◆ RB_VM_LOCK_ENTER_CR_LEV

#define RB_VM_LOCK_ENTER_CR_LEV | ( |  | cr,
|  |  | levp
| ) |  | rb_vm_lock_enter_cr(cr, levp, __FILE__, __LINE__)

Definition at line 116 of file vm_sync.h.

## ◆ RB_VM_LOCK_ENTER_LEV

#define RB_VM_LOCK_ENTER_LEV | ( |  | levp | ) | rb_vm_lock_enter(levp, __FILE__, __LINE__)

Definition at line 118 of file vm_sync.h.

## ◆ RB_VM_LOCK_ENTER_LEV_NB

#define RB_VM_LOCK_ENTER_LEV_NB | ( |  | levp | ) | rb_vm_lock_enter_nb(levp, __FILE__, __LINE__)

Definition at line 124 of file vm_sync.h.

## ◆ RB_VM_LOCK_ENTER_NO_BARRIER

#define RB_VM_LOCK_ENTER_NO_BARRIER | ( |  | ) | { unsigned int _lev; RB_VM_LOCK_ENTER_LEV_NB(&_lev);

Definition at line 125 of file vm_sync.h.

## ◆ RB_VM_LOCK_LEAVE

#define RB_VM_LOCK_LEAVE | ( |  | ) | RB_VM_LOCK_LEAVE_LEV(&_lev); }

Definition at line 122 of file vm_sync.h.

## ◆ RB_VM_LOCK_LEAVE_CR_LEV

#define RB_VM_LOCK_LEAVE_CR_LEV | ( |  | cr,
|  |  | levp
| ) |  | rb_vm_lock_leave_cr(cr, levp, __FILE__, __LINE__)

Definition at line 117 of file vm_sync.h.

## ◆ RB_VM_LOCK_LEAVE_LEV

#define RB_VM_LOCK_LEAVE_LEV | ( |  | levp | ) | rb_vm_lock_leave(levp, __FILE__, __LINE__)

Definition at line 119 of file vm_sync.h.

## ◆ RB_VM_LOCK_LEAVE_NO_BARRIER

#define RB_VM_LOCK_LEAVE_NO_BARRIER | ( |  | ) | RB_VM_LOCK_LEAVE_LEV(&_lev); }

Definition at line 126 of file vm_sync.h.

## ◆ RB_VM_LOCKED_P

#define RB_VM_LOCKED_P | ( |  | ) | rb_vm_locked_p()

Definition at line 111 of file vm_sync.h.

## ◆ RB_VM_UNLOCK

#define RB_VM_UNLOCK | ( |  | ) | rb_vm_unlock(__FILE__, __LINE__)

Definition at line 114 of file vm_sync.h.

## Function Documentation

## ◆ rb_vm_barrier()

void rb_vm_barrier | ( | void |  | ) |

Definition at line 229 of file vm_sync.c.

References ASSERT_vm_locking, rb_vm_struct::barrier_cnt, rb_vm_struct::barrier_cond, rb_ractor_struct::barrier_wait_cond, rb_vm_struct::barrier_waiting, rb_vm_struct::blocking_cnt, rb_vm_struct::cnt, rb_vm_struct::lock_owner, rb_vm_struct::ractor, RB_DEBUG_COUNTER_INC, rb_native_cond_signal(), rb_ractor_vm_barrier_interrupt_running_thread(), rb_vm_cond_wait(), rb_vm_ractor_blocking_cnt_dec(), rb_vm_ractor_blocking_cnt_inc(), RUBY_DEBUG_LOG, rb_vm_struct::set, rb_vm_struct::sync, and VM_ASSERT.

## ◆ rb_vm_lock_body()

void rb_vm_lock_body | ( | LOCATION_ARGS |  | ) |

Definition at line 168 of file vm_sync.c.

References APPEND_LOCATION_PARAMS, ASSERT_vm_unlocking, rb_vm_struct::lock_rec, rb_vm_struct::ractor, and rb_vm_struct::sync.

## ◆ rb_vm_lock_enter_body()

void rb_vm_lock_enter_body | ( | unsigned int *lev | APPEND_LOCATION_ARGS | ) |

Definition at line 131 of file vm_sync.c.

References APPEND_LOCATION_PARAMS, and NULL.

## ◆ rb_vm_lock_enter_body_cr()

void rb_vm_lock_enter_body_cr | ( | struct rb_ractor_struct * | cr,
|  | unsigned int *lev | APPEND_LOCATION_ARGS
| ) |  |

Definition at line 155 of file vm_sync.c.

References APPEND_LOCATION_PARAMS.

## ◆ rb_vm_lock_enter_body_nb()

void rb_vm_lock_enter_body_nb | ( | unsigned int *lev | APPEND_LOCATION_ARGS | ) |

Definition at line 143 of file vm_sync.c.

References APPEND_LOCATION_PARAMS, and NULL.

## ◆ rb_vm_lock_leave_body()

void rb_vm_lock_leave_body | ( | unsigned int *lev | APPEND_LOCATION_ARGS | ) |

Definition at line 162 of file vm_sync.c.

References APPEND_LOCATION_PARAMS.

## ◆ rb_vm_locked_p()

bool rb_vm_locked_p | ( | void |  | ) |

Definition at line 36 of file vm_sync.c.

## ◆ rb_vm_unlock_body()

void rb_vm_unlock_body | ( | LOCATION_ARGS |  | ) |

Definition at line 177 of file vm_sync.c.

References APPEND_LOCATION_PARAMS, ASSERT_vm_locking, rb_vm_struct::lock_rec, rb_vm_struct::ractor, rb_vm_struct::sync, and VM_ASSERT.

## Variable Documentation

## ◆ ruby_single_main_ractor

struct rb_ractor_struct* ruby_single_main_ractor
| extern

Definition at line 381 of file vm.c.

Referenced by rb_ractor_main_alloc().