Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include "ruby/internal/config.h"
#include "eval_intern.h"
#include "gc.h"
#include "hrtime.h"
#include "internal.h"
#include "internal/class.h"
#include "internal/cont.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/io.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/scheduler.h"
#include "internal/signal.h"
#include "internal/thread.h"
#include "internal/time.h"
#include "internal/warnings.h"
#include "iseq.h"
#include "mjit.h"
#include "ruby/debug.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/thread_native.h"
#include "timev.h"
#include "vm_core.h"
#include "ractor_core.h"
#include "vm_debug.h"
#include "vm_sync.h"
#include "thread_sync.c"
Go to the source code of this file.
Data Structures | |
struct | waiting_fd |
struct | rb_blocking_region_buffer |
struct | thread_create_params |
struct | join_arg |
struct | select_set |
struct | select_args |
struct | thgroup |
struct | exec_recursive_params |
Macros | |
#define | __USE_FORTIFY_LEVEL 0 |
#define | USE_NATIVE_THREAD_PRIORITY 0 |
#define | RUBY_THREAD_PRIORITY_MAX 3 |
#define | RUBY_THREAD_PRIORITY_MIN -3 |
#define | THREAD_DEBUG 0 |
#define | THREAD_LOCAL_STORAGE_INITIALISED FL_USER13 |
#define | THREAD_LOCAL_STORAGE_INITIALISED_P(th) RB_FL_TEST_RAW((th), THREAD_LOCAL_STORAGE_INITIALISED) |
#define | eKillSignal INT2FIX(0) |
#define | eTerminateSignal INT2FIX(1) |
#define | THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION |
#define | GVL_UNLOCK_BEGIN(th) |
#define | GVL_UNLOCK_END(th) |
#define | only_if_constant(expr, notconst) (__builtin_constant_p(expr) ? (expr) : (notconst)) |
#define | BLOCKING_REGION(th, exec, ubf, ubfarg, fail_if_interrupted) |
#define | RUBY_VM_CHECK_INTS_BLOCKING(ec) vm_check_ints_blocking(ec) |
#define | thread_debug if(0)printf |
#define | fill_thread_id_string(thid, buf) ((void *)(uintptr_t)(thid)) |
#define | fill_thread_id_str(th) (void)0 |
#define | thread_id_str(th) ((void *)(uintptr_t)(th)->thread_id) |
#define | PRI_THREAD_ID "p" |
#define | BUSY_WAIT_SIGNALS (0) |
#define | USE_EVENTFD (0) |
#define | threadptr_initialized(th) ((th)->invoke_type != thread_invoke_type_none) |
#define | TIMESPEC_SEC_MAX TIMET_MAX |
#define | TIMESPEC_SEC_MIN TIMET_MIN |
#define | PRIu64 PRI_64_PREFIX "u" |
#define | rb_fd_no_init(fds) (void)(fds) |
#define | restore_fdset(dst, src) ((dst) ? rb_fd_dup(dst, src) : (void)0) |
#define | do_select_update() |
#define | fd_init_copy(f) |
#define | GetThreadShieldPtr(obj) ((VALUE)rb_check_typeddata((obj), &thread_shield_data_type)) |
#define | THREAD_SHIELD_WAITING_MASK (((FL_USER19-1)&~(FL_USER0-1))|FL_USER19) |
#define | THREAD_SHIELD_WAITING_SHIFT (FL_USHIFT) |
#define | THREAD_SHIELD_WAITING_MAX (THREAD_SHIELD_WAITING_MASK>>THREAD_SHIELD_WAITING_SHIFT) |
#define | OBJ_ID_EQL(obj_id, other) ((obj_id) == (other)) |
Enumerations | |
enum | SLEEP_FLAGS { SLEEP_DEADLOCKABLE = 0x1 , SLEEP_SPURIOUS_CHECK = 0x2 } |
enum | handle_interrupt_timing { INTERRUPT_NONE , INTERRUPT_IMMEDIATE , INTERRUPT_ON_BLOCKING , INTERRUPT_NEVER } |
#define BLOCKING_REGION | ( | th, | |
exec, | |||
ubf, | |||
ubfarg, | |||
fail_if_interrupted | |||
) |
#define do_select_update | ( | ) |
#define fd_init_copy | ( | f | ) |
#define GetThreadShieldPtr | ( | obj | ) | ((VALUE)rb_check_typeddata((obj), &thread_shield_data_type)) |
#define GVL_UNLOCK_BEGIN | ( | th | ) |
#define GVL_UNLOCK_END | ( | th | ) |
#define OBJ_ID_EQL | ( | obj_id, | |
other | |||
) | ((obj_id) == (other)) |
#define only_if_constant | ( | expr, | |
notconst | |||
) | (__builtin_constant_p(expr) ? (expr) : (notconst)) |
#define restore_fdset | ( | dst, | |
src | |||
) | ((dst) ? rb_fd_dup(dst, src) : (void)0) |
#define RUBY_VM_CHECK_INTS_BLOCKING | ( | ec | ) | vm_check_ints_blocking(ec) |
#define thread_id_str | ( | th | ) | ((void *)(uintptr_t)(th)->thread_id) |
#define THREAD_LOCAL_STORAGE_INITIALISED_P | ( | th | ) | RB_FL_TEST_RAW((th), THREAD_LOCAL_STORAGE_INITIALISED) |
#define THREAD_SHIELD_WAITING_MAX (THREAD_SHIELD_WAITING_MASK>>THREAD_SHIELD_WAITING_SHIFT) |
#define threadptr_initialized | ( | th | ) | ((th)->invoke_type != thread_invoke_type_none) |
enum SLEEP_FLAGS |
void Init_Thread | ( | void | ) |
Definition at line 5457 of file thread.c.
References ID2SYM, rb_thread_struct::pending_interrupt_mask_stack, rb_thread_struct::pending_interrupt_queue, rb_thread_struct::pending_interrupt_queue_checked, rb_thread_struct::ractor, rb_ary_tmp_new(), rb_cObject, rb_cThread, rb_define_alias(), rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_define_method, rb_define_singleton_method, rb_eIOError, rb_eStandardError, rb_eThreadError, rb_obj_alloc(), rb_ractor_gvl(), rb_thread_group(), rb_thread_kill(), rb_thread_run(), rb_thread_wakeup(), rb_vm_register_special_exception, ruby_error_stream_closed, rb_thread_struct::thgroup, and rb_ractor_struct::thgroup_default.
void Init_Thread_Mutex | ( | void | ) |
Definition at line 5432 of file thread.c.
References rb_thread_struct::interrupt_lock, rb_native_mutex_initialize(), rb_thread_struct::vm, rb_vm_struct::waitpid_lock, and rb_vm_struct::workqueue_lock.
void rb_clear_coverages | ( | void | ) |
Definition at line 4739 of file thread.c.
References rb_get_coverages(), rb_hash_foreach(), and RTEST.
Referenced by rb_reset_coverages().
Definition at line 5815 of file thread.c.
References COVERAGE_INDEX_BRANCHES, COVERAGE_INDEX_LINES, COVERAGE_TARGET_BRANCHES, COVERAGE_TARGET_LINES, Qfalse, rb_ary_tmp_new(), rb_ary_tmp_new_fill(), rb_hash_new(), and rb_obj_hide().
Referenced by rb_iseq_new_top().
void rb_ec_clear_current_thread_trace_func | ( | const rb_execution_context_t * | ec | ) |
Definition at line 277 of file vm_trace.c.
int rb_ec_reset_raised | ( | rb_execution_context_t * | ec | ) |
Definition at line 2597 of file thread.c.
References RAISED_EXCEPTION, and rb_execution_context_struct::raised_flag.
Referenced by rb_suppress_tracing().
int rb_ec_set_raised | ( | rb_execution_context_t * | ec | ) |
Definition at line 2587 of file thread.c.
References RAISED_EXCEPTION, and rb_execution_context_struct::raised_flag.
Definition at line 5360 of file thread.c.
References exec_recursive_params::arg, exec_recursive_params::func, and exec_recursive_params::obj.
Referenced by rb_error_frozen_object(), rb_invcmp(), and rb_io_puts().
Definition at line 5383 of file thread.c.
References exec_recursive_params::arg, exec_recursive_params::func, and exec_recursive_params::obj.
Referenced by rb_hash().
VALUE rb_exec_recursive_paired | ( | VALUE(*)(VALUE, VALUE, int) | func, |
VALUE | obj, | ||
VALUE | paired_obj, | ||
VALUE | arg | ||
) |
Definition at line 5371 of file thread.c.
References exec_recursive_params::arg, exec_recursive_params::func, exec_recursive_params::obj, and rb_memory_id().
Referenced by rb_ary_cmp(), and rb_num_coerce_bit().
VALUE rb_exec_recursive_paired_outer | ( | VALUE(*)(VALUE, VALUE, int) | func, |
VALUE | obj, | ||
VALUE | paired_obj, | ||
VALUE | arg | ||
) |
Definition at line 5395 of file thread.c.
References exec_recursive_params::arg, exec_recursive_params::func, exec_recursive_params::obj, and rb_memory_id().
int rb_get_coverage_mode | ( | void | ) |
Definition at line 5779 of file thread.c.
Referenced by rb_iseq_new_top().
VALUE rb_get_coverages | ( | void | ) |
Definition at line 5773 of file thread.c.
Referenced by rb_clear_coverages(), and rb_iseq_new_top().
rb_hrtime_t rb_hrtime_now | ( | void | ) |
VALUE rb_io_prep_stderr | ( | void | ) |
Definition at line 8223 of file io.c.
References FMODE_SYNC, FMODE_WRITABLE, and rb_cIO.
Referenced by Init_IO().
VALUE rb_io_prep_stdin | ( | void | ) |
Definition at line 8211 of file io.c.
References FMODE_READABLE, and rb_cIO.
Referenced by Init_IO().
VALUE rb_io_prep_stdout | ( | void | ) |
Definition at line 8217 of file io.c.
References FMODE_SIGNAL_ON_EPIPE, FMODE_WRITABLE, and rb_cIO.
Referenced by Init_IO().
void rb_nativethread_lock_destroy | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 436 of file thread.c.
References rb_native_mutex_destroy().
void rb_nativethread_lock_initialize | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 430 of file thread.c.
References rb_native_mutex_initialize().
void rb_nativethread_lock_lock | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 442 of file thread.c.
References rb_native_mutex_lock().
Referenced by rb_grantpt(), rb_postponed_job_flush(), and rb_workqueue_register().
void rb_nativethread_lock_unlock | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 448 of file thread.c.
References rb_native_mutex_unlock().
Referenced by rb_grantpt(), rb_postponed_job_flush(), and rb_workqueue_register().
void * rb_nogvl | ( | void *(*)(void *) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2, | ||
int | flags | ||
) |
Definition at line 1670 of file thread.c.
References BLOCKING_REGION, rb_vm_struct::main_thread, Qfalse, rb_vm_struct::ractor, rb_thread_struct::ractor, RB_NOGVL_INTR_FAIL, RB_NOGVL_UBF_ASYNC_SAFE, rb_ractor_living_thread_num(), rb_thread_kill(), RUBY_UBF_IO, RUBY_UBF_PROCESS, RUBY_VM_CHECK_INTS_BLOCKING, and rb_vm_struct::ubf_async_safe.
Referenced by rb_thread_call_without_gvl(), and rb_thread_call_without_gvl2().
Definition at line 2607 of file thread.c.
References err, waiting_fd::fd, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), RB_VM_LOCK_ENTER, RB_VM_LOCK_LEAVE, ruby_error_stream_closed, rb_vm_struct::special_exceptions, waiting_fd::th, rb_thread_struct::vm, rb_vm_struct::waiting_fds, and waiting_fd::wfd_node.
Referenced by rb_thread_fd_close().
void rb_reset_coverages | ( | void | ) |
Definition at line 5800 of file thread.c.
References COVERAGE_TARGET_BRANCHES, COVERAGE_TARGET_METHODS, Qfalse, rb_clear_coverages(), rb_iseq_remove_coverage_all(), and rb_remove_event_hook().
const rb_method_entry_t * rb_resolve_me_location | ( | const rb_method_entry_t * | me, |
VALUE | resolved_location[5] | ||
) |
Definition at line 5694 of file thread.c.
References rb_method_definition_struct::alias, rb_code_location_struct::beg_pos, rb_method_definition_struct::bmethod, rb_method_definition_struct::body, rb_iseq_struct::body, rb_iseq_location_struct::code_location, rb_code_position_struct::column, rb_method_entry_struct::def, rb_code_location_struct::end_pos, INT2FIX, rb_method_definition_struct::iseq, rb_method_iseq_struct::iseqptr, rb_code_position_struct::lineno, rb_iseq_constant_body::location, NULL, rb_method_refined_struct::orig_me, rb_method_alias_struct::original_me, rb_method_bmethod_struct::proc, rb_ary_entry(), rb_iseq_path(), rb_proc_get_iseq(), rb_method_definition_struct::refined, T_ARRAY, T_STRING, VM_METHOD_TYPE_ALIAS, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_ISEQ, and VM_METHOD_TYPE_REFINED.
Definition at line 5785 of file thread.c.
References COVERAGE_TARGET_BRANCHES, COVERAGE_TARGET_METHODS, Qnil, rb_add_event_hook2(), RUBY_EVENT_CALL, RUBY_EVENT_COVERAGE_BRANCH, RUBY_EVENT_COVERAGE_LINE, RUBY_EVENT_HOOK_FLAG_RAW_ARG, and RUBY_EVENT_HOOK_FLAG_SAFE.
void rb_sigwait_fd_migrate | ( | rb_vm_t * | vm | ) |
Definition at line 1125 of file process.c.
References rb_native_mutex_lock(), rb_native_mutex_unlock(), and rb_vm_struct::waitpid_lock.
Referenced by rb_threadptr_execute_interrupts().
int rb_thread_alone | ( | void | ) |
Definition at line 3757 of file thread.c.
References rb_ractor_living_thread_num().
Referenced by rb_thread_stop().
void * rb_thread_call_with_gvl | ( | void *(*)(void *) | func, |
void * | data1 | ||
) |
Definition at line 1892 of file thread.c.
References rb_unblock_callback::arg, rb_thread_struct::blocking_region_buffer, bp, EXIT_FAILURE, FALSE, rb_unblock_callback::func, if(), rb_bug(), RUBY_ASSERT_ALWAYS, and rb_thread_struct::unblock.
Referenced by ossl_generate_cb_2().
void * rb_thread_call_without_gvl | ( | void *(*)(void *data) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
Definition at line 1808 of file thread.c.
References rb_nogvl().
void * rb_thread_call_without_gvl2 | ( | void *(*)(void *) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
Definition at line 1801 of file thread.c.
References rb_nogvl(), and RB_NOGVL_INTR_FAIL.
void rb_thread_check_ints | ( | void | ) |
Definition at line 1577 of file thread.c.
References RUBY_VM_CHECK_INTS_BLOCKING.
Referenced by rb_io_wait_readable(), and rb_io_wait_writable().
int rb_thread_check_trap_pending | ( | void | ) |
Definition at line 1587 of file thread.c.
References rb_signal_buff_size().
Definition at line 1119 of file thread.c.
References thread_create_params::fn, rb_cThread, rb_thread_alloc(), and thread_create_params::type.
VALUE rb_thread_create_ractor | ( | rb_ractor_t * | g, |
VALUE | args, | ||
VALUE | proc | ||
) |
Definition at line 1130 of file thread.c.
References thread_create_params::args, g, thread_create_params::proc, rb_cThread, rb_thread_alloc(), and thread_create_params::type.
VALUE rb_thread_current | ( | void | ) |
Definition at line 2911 of file thread.c.
Referenced by rb_autoload_load(), rb_f_kill(), VpGetPrecLimit(), and VpGetRoundMode().
void rb_thread_execute_interrupts | ( | VALUE | thval | ) |
Definition at line 2525 of file thread.c.
References rb_threadptr_execute_interrupts().
Referenced by rb_f_kill().
void rb_thread_fd_close | ( | int | fd | ) |
Definition at line 2634 of file thread.c.
References rb_notify_fd_close(), and rb_thread_schedule().
int rb_thread_fd_select | ( | int | max, |
rb_fdset_t * | read, | ||
rb_fdset_t * | write, | ||
rb_fdset_t * | except, | ||
struct timeval * | timeout | ||
) |
Definition at line 4330 of file thread.c.
References rb_thread_struct::ec, select_set::eset, fd_init_copy, max, select_set::max, select_set::orig_rset, rb_ensure(), rb_fd_set, rb_sigwait_fd_get(), rb_thread_sleep_forever(), rb_thread_wait_for(), read(), select_set::rset, RUBY_VM_CHECK_INTS_BLOCKING, select_set::sigwait_fd, select_set::th, select_set::timeout, write(), and select_set::wset.
Definition at line 1594 of file thread.c.
References RUBY_VM_INTERRUPTED.
VALUE rb_thread_io_blocking_region | ( | rb_blocking_function_t * | func, |
void * | data1, | ||
int | fd | ||
) |
Definition at line 1815 of file thread.c.
References BLOCKING_REGION, COROUTINE_STACK_FREE, COROUTINE_STACK_LOCAL, EC_EXEC_TAG, EC_JUMP_TAG, EC_POP_TAG, EC_PUSH_TAG, FALSE, Qundef, RB_VM_LOCK_ENTER, RB_VM_LOCK_LEAVE, RUBY_VM_CHECK_INTS_BLOCKING, and TAG_NONE.
Definition at line 2694 of file thread.c.
References eKillSignal, EXIT_SUCCESS, rb_vm_struct::main_thread, PRI_THREAD_ID, rb_vm_struct::ractor, rb_exit(), rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), thread_debug, thread_id_str, THREAD_KILLED, rb_thread_struct::to_kill, and rb_thread_struct::vm.
Referenced by Init_Thread(), and rb_nogvl().
VALUE rb_thread_list | ( | void | ) |
Definition at line 2878 of file thread.c.
References rb_ractor_thread_list().
Definition at line 3480 of file thread.c.
Referenced by VpGetPrecLimit(), and VpGetRoundMode().
Definition at line 3628 of file thread.c.
References OBJ_FROZEN, and rb_frozen_error_raise().
Referenced by rb_detach_process().
Definition at line 2835 of file thread.c.
References rb_thread_schedule(), and rb_thread_wakeup().
Referenced by Init_Thread().
void rb_thread_schedule | ( | void | ) |
Definition at line 1623 of file thread.c.
References RUBY_VM_CHECK_INTS.
Referenced by rb_thread_fd_close(), and rb_thread_run().
VALUE rb_thread_shield_new | ( | void | ) |
Definition at line 5072 of file thread.c.
References DATA_PTR, and rb_mutex_lock().
Definition at line 5117 of file thread.c.
References Qfalse, Qtrue, and rb_mutex_unlock().
Definition at line 5088 of file thread.c.
References DATA_PTR, rb_mutex_struct::fiber, GetThreadShieldPtr, Qfalse, Qnil, Qtrue, rb_mutex_lock(), and rb_mutex_unlock().
void rb_thread_sleep | ( | int | sec | ) |
Definition at line 1600 of file thread.c.
References INT2FIX, rb_thread_wait_for(), and rb_time_timeval().
void rb_thread_sleep_deadly | ( | void | ) |
Definition at line 1531 of file thread.c.
References SLEEP_DEADLOCKABLE, SLEEP_SPURIOUS_CHECK, and thread_debug.
Referenced by rb_thread_stop().
void rb_thread_sleep_forever | ( | void | ) |
Definition at line 1524 of file thread.c.
References SLEEP_SPURIOUS_CHECK, and thread_debug.
Referenced by rb_thread_fd_select().
void rb_thread_sleep_interruptible | ( | void | ) |
Definition at line 1538 of file thread.c.
References rb_thread_struct::ec, RUBY_VM_CHECK_INTS_BLOCKING, and THREAD_STOPPED.
VALUE rb_thread_stop | ( | void | ) |
Definition at line 2844 of file thread.c.
References Qnil, rb_eThreadError, rb_raise(), rb_thread_alone(), and rb_thread_sleep_deadly().
void rb_thread_terminate_all | ( | rb_thread_t * | th | ) |
Definition at line 581 of file thread.c.
References rb_thread_struct::ec, EC_EXEC_TAG, EC_POP_TAG, EC_PUSH_TAG, rb_ractor_struct::main, rb_thread_struct::ractor, rb_bug(), RB_HRTIME_PER_SEC, rb_ractor_living_thread_num(), rb_threadptr_unlock_all_locking_mutexes(), RUBY_VM_CHECK_INTS_BLOCKING, TAG_NONE, thread_debug, and rb_ractor_struct::threads.
Referenced by rb_ractor_terminate_all().
Definition at line 2720 of file thread.c.
References FALSE, THREAD_KILLED, rb_thread_struct::to_kill, and TRUE.
void rb_thread_wait_fd | ( | int | fd | ) |
Definition at line 4305 of file thread.c.
Referenced by rb_io_read_check(), and rb_io_wait_readable().
void rb_thread_wait_for | ( | struct timeval | time | ) |
Definition at line 1562 of file thread.c.
References SLEEP_SPURIOUS_CHECK.
Referenced by rb_thread_fd_select(), and rb_thread_sleep().
Definition at line 4551 of file thread.c.
References select_args::as, select_args::error, select_args::except, waiting_fd::fd, select_args::fd, int(), NULL, ptr, rb_ensure(), RB_VM_LOCK_ENTER, RB_VM_LOCK_LEAVE, RB_WAITFD_IN, RB_WAITFD_OUT, RB_WAITFD_PRI, select_args::read, waiting_fd::th, select_args::timeout, select_args::tv, rb_thread_struct::vm, rb_vm_struct::waiting_fds, select_args::wfd, waiting_fd::wfd_node, and select_args::write.
Referenced by rb_io_wait(), and rb_wait_for_single_fd().
Definition at line 2788 of file thread.c.
References rb_eThreadError, rb_raise(), rb_thread_wakeup_alive(), and RTEST.
Referenced by Init_Thread(), and rb_thread_run().
Definition at line 2797 of file thread.c.
References Qnil, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by rb_thread_wakeup().
void rb_threadptr_check_signal | ( | rb_thread_t * | mth | ) |
Definition at line 4598 of file thread.c.
References rb_signal_buff_size().
Referenced by rb_f_kill().
int rb_threadptr_execute_interrupts | ( | rb_thread_t * | th, |
int | blocking_timing | ||
) |
Definition at line 2424 of file thread.c.
References rb_execution_context_struct::cfp, rb_thread_struct::ec, eKillSignal, err, eTerminateSignal, EXEC_EVENT_HOOK, FALSE, INT2FIX, INTERRUPT_NONE, INTERRUPT_ON_BLOCKING, rb_vm_struct::main_thread, PENDING_INTERRUPT_MASK, POSTPONED_JOB_INTERRUPT_MASK, rb_blocking_region_buffer::prev_status, PRIdVALUE, rb_thread_struct::priority, Qundef, rb_vm_struct::ractor, rb_execution_context_struct::raised_flag, rb_exc_raise(), rb_get_next_signal(), rb_postponed_job_flush(), rb_signal_exec(), rb_sigwait_fd_get(), rb_sigwait_fd_migrate(), rb_sigwait_fd_put(), RB_VM_LOCK_ENTER, RB_VM_LOCK_LEAVE, ruby_error_stream_closed, RUBY_INTERNAL_EVENT_SWITCH, ruby_sigchld_handler(), ruby_vm_special_exception_copy(), rb_thread_struct::running_time_us, rb_control_frame_struct::self, rb_vm_struct::special_exceptions, TAG_FATAL, TERMINATE_INTERRUPT_MASK, thread_debug, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, TIMER_INTERRUPT_MASK, TRAP_INTERRUPT_MASK, TRUE, rb_thread_struct::vm, VM_ASSERT, and VM_BARRIER_INTERRUPT_MASK.
Referenced by rb_thread_execute_interrupts().
void rb_threadptr_interrupt | ( | rb_thread_t * | th | ) |
Definition at line 508 of file thread.c.
Referenced by rb_notify_fd_close(), rb_ractor_terminate_interrupt_main_thread(), and rb_thread_kill().
void rb_threadptr_pending_interrupt_clear | ( | rb_thread_t * | th | ) |
Definition at line 1981 of file thread.c.
References rb_thread_struct::pending_interrupt_queue, and rb_ary_clear().
void rb_threadptr_pending_interrupt_enque | ( | rb_thread_t * | th, |
VALUE | v | ||
) |
Definition at line 1987 of file thread.c.
References rb_thread_struct::pending_interrupt_queue, rb_thread_struct::pending_interrupt_queue_checked, and rb_ary_push().
Referenced by rb_fiber_start(), rb_notify_fd_close(), and rb_thread_kill().
void rb_threadptr_root_fiber_terminate | ( | rb_thread_t * | th | ) |
Definition at line 2130 of file cont.c.
References rb_thread_struct::ec, rb_execution_context_struct::fiber_ptr, FIBER_TERMINATED, and rb_ec_clear_vm_stack().
void rb_threadptr_signal_exit | ( | rb_thread_t * | th | ) |
Definition at line 2575 of file thread.c.
References argv, rb_vm_struct::main_thread, rb_vm_struct::ractor, rb_eSystemExit, rb_str_new2, and rb_thread_struct::vm.
Referenced by rb_signal_exec().
void rb_threadptr_signal_raise | ( | rb_thread_t * | th, |
int | sig | ||
) |
Definition at line 2565 of file thread.c.
References argv, INT2FIX, rb_vm_struct::main_thread, rb_vm_struct::ractor, rb_eSignal, and rb_thread_struct::vm.
Referenced by rb_signal_exec().
void rb_threadptr_unlock_all_locking_mutexes | ( | rb_thread_t * | th | ) |
Definition at line 567 of file thread.c.
References rb_mutex_struct::fiber, rb_thread_struct::keeping_mutexes, rb_mutex_struct::next_mutex, and rb_bug().
Referenced by rb_thread_terminate_all().
Definition at line 5874 of file thread.c.
References rb_thread_struct::ec, OBJ_FREEZE_RAW, rb_thread_struct::pending_interrupt_mask_stack, Qnil, rb_ary_push(), rb_cObject, rb_ensure(), rb_hash_aset(), rb_ident_hash_new(), and RUBY_VM_CHECK_INTS.
int rb_vm_check_ints_blocking | ( | rb_execution_context_t * | ec | ) |
void rb_vm_gvl_destroy | ( | rb_global_vm_lock_t * | gvl | ) |
VALUE rb_vm_invoke_proc_with_self | ( | rb_execution_context_t * | ec, |
rb_proc_t * | proc, | ||
VALUE | self, | ||
int | argc, | ||
const VALUE * | argv, | ||
int | kw_splat, | ||
VALUE | passed_block_handler | ||
) |
Definition at line 1490 of file vm.c.
References argc, argv, NULL, rb_block::proc, and rb_vm_invoke_bmethod().
Definition at line 675 of file thread.c.
References NULL, and rb_vm_ep_local_ep().
Referenced by rb_fiber_start().
void ruby_sigchld_handler | ( | rb_vm_t * | vm | ) |
Definition at line 1090 of file signal.c.
References GET_SIGCHLD_HIT, ruby_waitpid_all(), and SIGCHLD_LOSSY.
Referenced by rb_threadptr_execute_interrupts().
int ruby_thread_has_gvl_p | ( | void | ) |
Definition at line 1935 of file thread.c.
References rb_thread_struct::blocking_region_buffer.
Referenced by rb_fatal(), and ruby_waitpid_locked().
void ruby_thread_init_stack | ( | rb_thread_t * | th | ) |
Definition at line 669 of file thread.c.
Referenced by Init_BareVM().
STATIC_ASSERT | ( | THREAD_SHIELD_WAITING_MAX | , |
THREAD_SHIELD_WAITING_MAX<= | UINT_MAX | ||
) |