Ruby: vm_sync.c File Reference

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

Functions
vm_sync.c File Reference
`#include "vm_core.h"`
`#include "vm_sync.h"`
`#include "ractor_core.h"`
`#include "vm_debug.h"`
`#include "gc.h"`

Go to the source code of this file.

## Functions
bool | rb_vm_locked_p (void)
void | rb_vm_lock_enter_body (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_cr (rb_ractor_t *cr, unsigned int *lev APPEND_LOCATION_ARGS)
void | rb_vm_lock_leave_body (unsigned int *lev APPEND_LOCATION_ARGS)
void | rb_vm_lock_body (LOCATION_ARGS)
void | rb_vm_unlock_body (LOCATION_ARGS)
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)
void | rb_vm_barrier (void)
void | rb_ec_vm_lock_rec_release (const rb_execution_context_t *ec, unsigned int recorded_lock_rec, unsigned int current_lock_rec)

## Function Documentation

## ◆ rb_ec_vm_lock_rec_release()

void rb_ec_vm_lock_rec_release | ( | const rb_execution_context_t * | ec,
|  | unsigned int | recorded_lock_rec,
|  | unsigned int | current_lock_rec
| ) |  |

Definition at line 282 of file vm_sync.c.

References rb_bug(), RB_VM_LOCK_LEAVE_LEV, UNLIKELY, and VM_ASSERT.

## ◆ 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_cond_timedwait()

void rb_vm_cond_timedwait | ( | rb_vm_t * | vm,
|  | rb_nativethread_cond_t * | cond,
|  | unsigned long | msec
| ) |  |

Definition at line 211 of file vm_sync.c.

Referenced by rb_ractor_terminate_all().

## ◆ rb_vm_cond_wait()

void rb_vm_cond_wait | ( | rb_vm_t * | vm,
|  | rb_nativethread_cond_t * | cond
| ) |  |

Definition at line 205 of file vm_sync.c.

Referenced by rb_vm_barrier().

## ◆ 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 | ( | rb_ractor_t * | 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.