Ruby
2.4.2p198(2017-09-14revision59899)
|
#include "eval_intern.h"
#include "gc.h"
#include "timev.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/thread_native.h"
#include "internal.h"
#include "thread_sync.c"
Go to the source code of this file.
Data Structures | |
struct | waiting_fd |
struct | rb_blocking_region_buffer |
struct | join_arg |
struct | select_args |
struct | thgroup |
struct | exec_recursive_params |
Enumerations | |
enum | handle_interrupt_timing { INTERRUPT_NONE, INTERRUPT_IMMEDIATE, INTERRUPT_ON_BLOCKING, INTERRUPT_NEVER } |
Variables | |
static VALUE | rb_cThreadShield |
static VALUE | sym_immediate |
static VALUE | sym_on_blocking |
static VALUE | sym_never |
static ID | id_locals |
static volatile int | system_working = 1 |
static ID | recursive_key |
static const rb_data_type_t | thgroup_data_type |
static const rb_data_type_t | thread_shield_data_type |
#define BLOCKING_REGION | ( | exec, | |
ubf, | |||
ubfarg, | |||
fail_if_interrupted | |||
) |
Definition at line 160 of file thread.c.
Referenced by call_without_gvl(), do_select(), rb_thread_fd_select(), and rb_thread_io_blocking_region().
#define DELAY_INFTY 1E30 |
Definition at line 830 of file thread.c.
Referenced by thread_join_m(), thread_join_sleep(), and thread_value().
#define do_select_update | ( | ) |
Referenced by do_select().
#define eKillSignal INT2FIX(0) |
Definition at line 94 of file thread.c.
Referenced by rb_thread_kill(), and rb_threadptr_execute_interrupts().
#define eTerminateSignal INT2FIX(1) |
Definition at line 95 of file thread.c.
Referenced by rb_threadptr_execute_interrupts(), and terminate_all().
#define fd_init_copy | ( | f | ) | (f##fds) ? rb_fd_init_copy(&orig_##f, f##fds) : rb_fd_no_init(&orig_##f) |
Referenced by do_select().
#define fd_term | ( | f | ) | if (f##fds) rb_fd_term(&orig_##f) |
Referenced by do_select().
#define fill_thread_id_string | ( | thid, | |
buf | |||
) | (thid) |
Definition at line 271 of file thread.c.
Referenced by vm_living_thread_num().
#define GetThreadShieldPtr | ( | obj | ) | ((VALUE)rb_check_typeddata((obj), &thread_shield_data_type)) |
Definition at line 4383 of file thread.c.
Referenced by rb_thread_shield_wait(), and thread_shield_get_mutex().
#define GVL_UNLOCK_BEGIN | ( | ) |
Definition at line 141 of file thread.c.
Referenced by rb_mutex_lock(), and ruby_kill().
#define GVL_UNLOCK_END | ( | ) |
Definition at line 146 of file thread.c.
Referenced by rb_mutex_lock(), and ruby_kill().
#define OBJ_ID_EQL | ( | obj_id, | |
other | |||
) | ((obj_id) == (other)) |
Referenced by recursive_check().
#define PRI_THREAD_ID "p" |
Definition at line 274 of file thread.c.
Referenced by debug_deadlock_check(), rb_thread_kill(), thread_join(), and thread_join_sleep().
#define RB_GC_SAVE_MACHINE_CONTEXT | ( | th | ) |
Definition at line 133 of file thread.c.
Referenced by blocking_region_begin(), and rb_thread_schedule_limits().
#define rb_intern | ( | str | ) | rb_intern_const(str) |
Referenced by Init_Thread().
#define rb_thread_shield_waiting | ( | b | ) | (int)((RBASIC(b)->flags&THREAD_SHIELD_WAITING_MASK)>>THREAD_SHIELD_WAITING_SHIFT) |
Definition at line 4386 of file thread.c.
Referenced by rb_thread_shield_destroy(), rb_thread_shield_release(), rb_thread_shield_wait(), rb_thread_shield_waiting_dec(), and rb_thread_shield_waiting_inc().
#define restore_fdset | ( | fds1, | |
fds2 | |||
) | ((fds1) ? rb_fd_dup(fds1, fds2) : (void)0) |
#define RUBY_THREAD_PRIORITY_MAX 3 |
Definition at line 70 of file thread.c.
Referenced by rb_thread_priority_set().
#define RUBY_THREAD_PRIORITY_MIN -3 |
Definition at line 71 of file thread.c.
Referenced by rb_thread_priority_set().
#define RUBY_VM_CHECK_INTS_BLOCKING | ( | th | ) | vm_check_ints_blocking(th) |
Definition at line 171 of file thread.c.
Referenced by call_without_gvl(), do_select(), rb_mutex_lock(), rb_thread_check_ints(), rb_thread_fd_select(), rb_thread_io_blocking_region(), rb_thread_terminate_all(), sleep_forever(), and sleep_timeval().
#define thread_debug if(0)printf |
Definition at line 267 of file thread.c.
Referenced by blocking_region_begin(), blocking_region_end(), rb_thread_kill(), rb_thread_schedule_limits(), rb_thread_sleep_deadly(), rb_thread_sleep_deadly_allow_spurious_wakeup(), rb_thread_sleep_forever(), rb_thread_terminate_all(), rb_thread_wait_fd_rw(), rb_threadptr_execute_interrupts(), sleep_timeval(), terminate_all(), thread_join(), thread_join_sleep(), and thread_start_func_2().
#define thread_id_str | ( | th | ) | ((void *)(th)->thread_id) |
Definition at line 273 of file thread.c.
Referenced by debug_deadlock_check(), rb_thread_kill(), thread_join(), and thread_join_sleep().
#define THREAD_SHIELD_WAITING_MASK (FL_USER0|FL_USER1|FL_USER2|FL_USER3|FL_USER4|FL_USER5|FL_USER6|FL_USER7|FL_USER8|FL_USER9|FL_USER10|FL_USER11|FL_USER12|FL_USER13|FL_USER14|FL_USER15|FL_USER16|FL_USER17|FL_USER18|FL_USER19) |
Definition at line 4384 of file thread.c.
Referenced by rb_thread_shield_waiting_dec(), and rb_thread_shield_waiting_inc().
#define THREAD_SHIELD_WAITING_SHIFT (FL_USHIFT) |
Definition at line 4385 of file thread.c.
Referenced by rb_thread_shield_waiting_dec(), and rb_thread_shield_waiting_inc().
#define thread_start_func_2 | ( | th, | |
st, | |||
rst | |||
) | thread_start_func_2(th, st) |
#define threadptr_initialized | ( | th | ) | ((th)->first_args != 0) |
Definition at line 745 of file thread.c.
Referenced by rb_thread_setname(), and thread_s_new().
|
inlinestatic |
Definition at line 1275 of file thread.c.
References rb_thread_struct::blocking_region_buffer, FALSE, rb_blocking_region_buffer::oldubf, rb_blocking_region_buffer::prev_status, RB_GC_SAVE_MACHINE_CONTEXT, set_unblock_function(), rb_thread_struct::status, thread_debug, THREAD_STOPPED, and TRUE.
Referenced by rb_thread_call_with_gvl().
|
inlinestatic |
Definition at line 1293 of file thread.c.
References rb_blocking_region_buffer::oldubf, rb_blocking_region_buffer::prev_status, rb_thread_set_current, reset_unblock_function(), thread_debug, THREAD_STOPPED, and rb_thread_struct::vm.
Referenced by rb_thread_call_with_gvl().
|
static |
Definition at line 1307 of file thread.c.
References BLOCKING_REGION, errno, func, GET_THREAD, RUBY_UBF_IO, RUBY_UBF_PROCESS, RUBY_VM_CHECK_INTS_BLOCKING, waiting_fd::th, and val.
Referenced by rb_thread_call_without_gvl(), and rb_thread_call_without_gvl2().
Definition at line 4909 of file thread.c.
References rb_mutex_struct::cond_waiting, GET_THREAD, GetMutexPtr, rb_thread_struct::interrupt_flag, rb_thread_struct::join_list, list, rb_vm_struct::living_threads, rb_mutex_struct::lock, rb_thread_struct::locking_mutex, rb_vm_struct::main_thread, rb_thread_list_struct::next, PRI_THREAD_ID, PRIsVALUE, rb_ary_join(), rb_str_catf(), rb_str_concat(), rb_str_new_cstr(), rb_vm_backtrace_str_ary(), rb_thread_struct::self, rb_vm_struct::sleeper, rb_mutex_struct::th, rb_thread_list_struct::th, thread_id_str, and vm_living_thread_num().
Referenced by rb_check_deadlock().
|
static |
Definition at line 3707 of file thread.c.
References BLOCKING_REGION, do_select_update, errno, FALSE, fd_init_copy, fd_term, GET_THREAD, MAYBE_UNUSED, result, retryable(), RUBY_VM_CHECK_INTS_BLOCKING, waiting_fd::th, timeofday(), timeval::tv_sec, and timeval::tv_usec.
Referenced by rb_thread_fd_select().
|
static |
Definition at line 1046 of file thread.c.
References timeval::tv_sec, timeval::tv_usec, and TYPEOF_TIMEVAL_TV_SEC.
Referenced by sleep_wait_for_interrupt().
|
static |
Definition at line 4633 of file thread.c.
References exec_recursive_params::arg, exec_recursive_i(), EXEC_TAG, FALSE, func, exec_recursive_params::func, ID2SYM, idNULL, JUMP_TAG, exec_recursive_params::list, exec_recursive_params::obj, exec_recursive_params::objid, exec_recursive_params::pairid, POP_TAG, PRIsVALUE, PUSH_TAG, Qundef, rb_catch_protect(), rb_eTypeError, rb_frame_last_func(), rb_obj_id(), rb_raise(), rb_thread_current(), rb_throw_obj(), recursive_check(), recursive_list_access(), recursive_pop(), recursive_push(), result, sym, and TRUE.
Referenced by rb_exec_recursive(), rb_exec_recursive_outer(), rb_exec_recursive_paired(), and rb_exec_recursive_paired_outer().
|
static |
Definition at line 4615 of file thread.c.
References exec_recursive_params::arg, FALSE, exec_recursive_params::func, and exec_recursive_params::obj.
Referenced by exec_recursive().
|
static |
Definition at line 1097 of file thread.c.
References clock_gettime(), CLOCK_MONOTONIC, gettimeofday(), NULL, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
Referenced by sleep_timeval().
Definition at line 1729 of file thread.c.
References rb_eArgError, rb_hash_aset(), rb_ident_hash_new(), rb_raise(), ST_CONTINUE, sym_immediate, sym_never, and sym_on_blocking.
Referenced by rb_thread_s_handle_interrupt().
|
static |
Definition at line 3938 of file thread.c.
References rb_fd_init, and rb_fd_set.
Referenced by rb_wait_for_single_fd().
void Init_Thread | ( | void | ) |
Definition at line 4784 of file thread.c.
References GET_THREAD, ID2SYM, id_locals, Init_thread_sync(), rb_thread_struct::interrupt_cond, rb_thread_struct::interrupt_lock, rb_thread_struct::interrupt_mask, rb_thread_struct::pending_interrupt_mask_stack, rb_thread_struct::pending_interrupt_queue, rb_thread_struct::pending_interrupt_queue_checked, rb_ary_tmp_new(), rb_cObject, rb_cThread, rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_define_method(), rb_define_singleton_method(), rb_eIOError, rb_eStandardError, rb_eThreadError, rb_intern, rb_obj_alloc(), rb_thread_abort_exc(), rb_thread_abort_exc_set(), rb_thread_alive_p(), rb_thread_aref(), rb_thread_aset(), rb_thread_backtrace_locations_m(), rb_thread_backtrace_m(), rb_thread_exit(), rb_thread_getname(), rb_thread_group(), rb_thread_key_p(), rb_thread_keys(), rb_thread_kill(), rb_thread_list(), rb_thread_pending_interrupt_p(), rb_thread_priority(), rb_thread_priority_set(), rb_thread_report_exc(), rb_thread_report_exc_set(), rb_thread_run(), rb_thread_s_abort_exc(), rb_thread_s_abort_exc_set(), rb_thread_s_handle_interrupt(), rb_thread_s_kill(), rb_thread_s_main(), rb_thread_s_pending_interrupt_p(), rb_thread_s_report_exc(), rb_thread_s_report_exc_set(), rb_thread_safe_level(), rb_thread_setname(), rb_thread_stop(), rb_thread_stop_p(), rb_thread_variable_get(), rb_thread_variable_p(), rb_thread_variable_set(), rb_thread_variables(), rb_thread_wakeup(), rb_vm_register_special_exception(), ruby_error_stream_closed, sym_immediate, sym_never, sym_on_blocking, rb_thread_struct::thgroup, thgroup_add(), rb_vm_struct::thgroup_default, thgroup_enclose(), thgroup_enclosed_p(), thgroup_list(), thgroup_s_alloc(), rb_vm_struct::thread_destruct_lock, thread_initialize(), thread_join_m(), thread_raise_m(), thread_s_current(), thread_s_new(), thread_s_pass(), thread_start(), thread_value(), and rb_thread_struct::vm.
Definition at line 3307 of file thread.c.
References rb_ary_push(), and ST_CONTINUE.
Referenced by rb_thread_variables().
NOINLINE | ( | static int | thread_start_func_2rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start | ) |
NORETURN | ( | void | ruby_thread_stack_overflowrb_thread_t *th | ) |
Referenced by rb_threadptr_signal_exit().
|
static |
Definition at line 4946 of file thread.c.
References argv, rb_mutex_struct::cond_waiting, debug_deadlock_check(), GET_THREAD, GetMutexPtr, rb_vm_struct::living_threads, rb_mutex_struct::lock, rb_thread_struct::locking_mutex, rb_vm_struct::main_thread, patrol_thread, rb_bug(), rb_eFatal, rb_str_new2, rb_threadptr_raise(), RUBY_VM_INTERRUPTED, rb_vm_struct::sleeper, rb_thread_struct::status, rb_mutex_struct::th, THREAD_STOPPED_FOREVER, vm_living_thread_num(), and rb_thread_struct::vmlt_node.
Referenced by rb_mutex_lock(), sleep_forever(), and thread_start_func_2().
Definition at line 4697 of file thread.c.
References exec_recursive(), and func.
Referenced by ary_join_1(), enumerator_inspect(), num_funcall0(), range_inspect(), rb_ary_inspect(), rb_file_join(), rb_hash_inspect(), rb_invcmp(), rb_io_puts(), rb_obj_inspect(), and rb_struct_inspect().
Definition at line 4720 of file thread.c.
References exec_recursive(), and func.
Referenced by rb_hash().
VALUE rb_exec_recursive_paired | ( | VALUE(*)(VALUE, VALUE, int) | func, |
VALUE | obj, | ||
VALUE | paired_obj, | ||
VALUE | arg | ||
) |
Definition at line 4708 of file thread.c.
References exec_recursive(), func, and rb_obj_id().
Referenced by hash_equal(), num_funcall1(), range_eq(), range_eql(), rb_ary_cmp(), rb_ary_eql(), rb_ary_equal(), rb_num_coerce_bit(), rb_struct_eql(), and rb_struct_equal().
VALUE rb_exec_recursive_paired_outer | ( | VALUE(*)(VALUE, VALUE, int) | func, |
VALUE | obj, | ||
VALUE | paired_obj, | ||
VALUE | arg | ||
) |
Definition at line 4732 of file thread.c.
References exec_recursive(), func, and rb_obj_id().
Referenced by cmp_equal().
ID rb_frame_last_func | ( | void | ) |
Definition at line 1018 of file eval.c.
References rb_thread_struct::cfp, frame_func_id(), GET_THREAD, RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P, and RUBY_VM_PREVIOUS_CONTROL_FRAME.
Referenced by exec_recursive(), and threadptr_recursive_hash_set().
VALUE rb_get_coverages | ( | void | ) |
Definition at line 5004 of file thread.c.
References GET_VM.
Referenced by coverage(), prepare_iseq_build(), rb_coverage_peek_result(), rb_coverage_start(), rb_reset_coverages(), and rb_thread_start_timer_thread().
void rb_nativethread_lock_destroy | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 356 of file thread.c.
Referenced by ossl_dyn_destroy_callback().
void rb_nativethread_lock_initialize | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 350 of file thread.c.
Referenced by Init_ossl_locks(), and ossl_dyn_create_callback().
void rb_nativethread_lock_lock | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 362 of file thread.c.
Referenced by ossl_lock_unlock().
void rb_nativethread_lock_unlock | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 368 of file thread.c.
Referenced by ossl_lock_unlock().
int rb_notify_fd_close | ( | int | fd | ) |
Definition at line 2200 of file thread.c.
References err, waiting_fd::fd, GET_THREAD, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), 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 io_close_fptr(), io_reopen(), rb_io_memsize(), and rb_thread_fd_close().
void rb_reset_coverages | ( | void | ) |
Definition at line 5026 of file thread.c.
References GET_VM, Qfalse, rb_get_coverages(), rb_hash_tbl_raw(), rb_remove_event_hook(), reset_coverage_i(), st_foreach, and update_coverage().
Referenced by rb_coverage_result().
void rb_set_coverages | ( | VALUE | coverages | ) |
Definition at line 5010 of file thread.c.
References GET_VM, Qnil, rb_add_event_hook(), RUBY_EVENT_COVERAGE, and update_coverage().
Referenced by rb_coverage_start().
Definition at line 2625 of file thread.c.
References rb_thread_struct::abort_on_exception, GetThreadPtr, Qfalse, Qtrue, and waiting_fd::th.
Referenced by Init_Thread().
Definition at line 2647 of file thread.c.
References rb_thread_struct::abort_on_exception, GetThreadPtr, RTEST, waiting_fd::th, and val.
Referenced by Init_Thread().
Definition at line 2881 of file thread.c.
References GetThreadPtr, Qfalse, Qtrue, rb_threadptr_dead(), and waiting_fd::th.
Referenced by Init_Thread().
int rb_thread_alone | ( | void | ) |
Definition at line 3274 of file thread.c.
References GET_VM, and vm_living_thread_num().
Referenced by rb_thread_schedule_limits(), rb_thread_stop(), and thread_start_func_2().
Definition at line 3117 of file thread.c.
References Qnil, rb_check_id(), and rb_thread_local_aref().
Referenced by Init_Thread().
Definition at line 3172 of file thread.c.
References rb_thread_local_aset(), and rb_to_id().
Referenced by Init_Thread().
void rb_thread_atfork | ( | void | ) |
Definition at line 4172 of file thread.c.
Referenced by pipe_open(), rb_exec_async_signal_safe(), and rb_thread_start_timer_thread().
void rb_thread_atfork_before_exec | ( | void | ) |
Definition at line 4177 of file thread.c.
Referenced by rb_thread_start_timer_thread().
Definition at line 4763 of file thread.c.
References rb_vm_thread_backtrace_locations().
Referenced by Init_Thread().
Definition at line 4746 of file thread.c.
References rb_vm_thread_backtrace().
Referenced by Init_Thread().
void* rb_thread_call_with_gvl | ( | void *(*)(void *) | func, |
void * | data1 | ||
) |
Definition at line 1499 of file thread.c.
References rb_unblock_callback::arg, blocking_region_begin(), rb_thread_struct::blocking_region_buffer, blocking_region_end(), EXIT_FAILURE, FALSE, rb_unblock_callback::func, if(), rb_bug(), waiting_fd::th, and rb_thread_struct::unblock.
Referenced by callback(), garbage_collect_with_gvl(), maygvl_copy_stream_continue_p(), negative_size_allocation_error(), ruby_memerror(), and zstream_run_func().
void* rb_thread_call_without_gvl | ( | void *(*)(void *data) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
Definition at line 1427 of file thread.c.
References call_without_gvl(), FALSE, and func.
void* rb_thread_call_without_gvl2 | ( | void *(*)(void *) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
Definition at line 1420 of file thread.c.
References call_without_gvl(), func, and TRUE.
Referenced by io_flush_buffer_async2(), mustbe_callable(), rb_execarg_parent_start1(), and rb_write_internal2().
void rb_thread_check_ints | ( | void | ) |
Definition at line 1215 of file thread.c.
References GET_THREAD, RUBY_VM_CHECK_INTS_BLOCKING, and waiting_fd::th.
Referenced by bary_short_mul(), BigMath_s_exp(), collect_all(), enum_to_h_i(), io_binwrite(), mustbe_callable(), rb_execarg_parent_start1(), rb_io_wait_readable(), and rb_io_wait_writable().
int rb_thread_check_trap_pending | ( | void | ) |
Definition at line 1226 of file thread.c.
References rb_signal_buff_size().
Definition at line 823 of file thread.c.
References rb_cThread, rb_thread_alloc(), and thread_create_core().
Referenced by rb_detach_process().
VALUE rb_thread_current | ( | void | ) |
Definition at line 2504 of file thread.c.
References GET_THREAD.
Referenced by chdir_yield(), check_autoload_required(), const_tbl_update(), copy_stream_body(), delete_current_thread(), dir_s_chdir(), exec_recursive(), parser_compile_error(), pipe_close(), queue_do_pop(), rb_autoload_load(), rb_autoloading_value(), rb_condvar_wait(), rb_f_kill(), rb_szqueue_push(), thread_s_current(), VpGetException(), VpGetPrecLimit(), and VpGetRoundMode().
void rb_thread_execute_interrupts | ( | VALUE | thval | ) |
Definition at line 2098 of file thread.c.
References GetThreadPtr, rb_threadptr_execute_interrupts(), and waiting_fd::th.
Referenced by exec_interrupts(), maygvl_copy_stream_continue_p(), and rb_f_kill().
|
static |
Definition at line 2357 of file thread.c.
References GET_THREAD, rb_thread_kill(), and rb_thread_struct::self.
Referenced by Init_Thread().
void rb_thread_fd_close | ( | int | fd | ) |
Definition at line 2226 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 3795 of file thread.c.
References BLOCKING_REGION, do_select(), errno, FALSE, waiting_fd::fd, GET_THREAD, NULL, rb_fd_resize, rb_thread_sleep_forever(), rb_thread_wait_for(), rb_wait_for_single_fd(), RB_WAITFD_IN, RB_WAITFD_OUT, RB_WAITFD_PRI, result, retryable(), RUBY_VM_CHECK_INTS_BLOCKING, waiting_fd::th, timeofday(), timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
Referenced by maygvl_select(), select_internal(), and select_single().
int rb_thread_fd_writable | ( | int | fd | ) |
Definition at line 3788 of file thread.c.
References rb_thread_wait_fd_rw(), and TRUE.
Referenced by io_binwrite_string(), and rb_io_wait_writable().
Definition at line 2947 of file thread.c.
References GetThreadPtr, rb_thread_struct::name, and waiting_fd::th.
Referenced by Init_Thread().
Definition at line 2778 of file thread.c.
References GetThreadPtr, Qnil, waiting_fd::th, and rb_thread_struct::thgroup.
Referenced by Init_Thread().
Definition at line 3000 of file thread.c.
References rb_thread_struct::first_func, rb_thread_struct::first_proc, GetThreadPtr, rb_thread_struct::name, NIL_P, OBJ_INFECT, PRIsVALUE, RARRAY_CONST_PTR, rb_class_path(), rb_gc_force_recycle(), rb_obj_class(), rb_proc_location(), rb_sprintf(), rb_str_catf(), waiting_fd::th, thread_status_name(), and TRUE.
Referenced by thread_cleanup_func(), and thread_start_func_2().
int rb_thread_interrupted | ( | VALUE | thval | ) |
Definition at line 1233 of file thread.c.
References GetThreadPtr, RUBY_VM_INTERRUPTED, and waiting_fd::th.
Referenced by maygvl_copy_stream_continue_p().
VALUE rb_thread_io_blocking_region | ( | rb_blocking_function_t * | func, |
void * | data1, | ||
int | fd | ||
) |
Definition at line 1434 of file thread.c.
References BLOCKING_REGION, errno, EXEC_TAG, FALSE, waiting_fd::fd, func, GET_THREAD, GET_VM, Qundef, RUBY_VM_CHECK_INTS_BLOCKING, waiting_fd::th, TH_JUMP_TAG, TH_POP_TAG, TH_PUSH_TAG, val, rb_vm_struct::waiting_fds, and waiting_fd::wfd_node.
Referenced by io_flush_buffer_async(), rb_file_flock(), rb_io_set_sync(), rb_io_sync(), rb_read_internal(), rb_write_internal(), rb_write_internal2(), and recvfrom_locktmp().
Definition at line 3250 of file thread.c.
References GetThreadPtr, rb_thread_struct::local_storage, Qfalse, Qtrue, rb_check_id(), st_lookup, and waiting_fd::th.
Referenced by Init_Thread().
Definition at line 3294 of file thread.c.
References GetThreadPtr, rb_thread_struct::local_storage, rb_ary_new(), st_foreach, waiting_fd::th, and thread_keys_i().
Referenced by Init_Thread().
Definition at line 2283 of file thread.c.
References eKillSignal, EXIT_SUCCESS, GET_THREAD, GetThreadPtr, rb_vm_struct::main_thread, PRI_THREAD_ID, rb_exit(), rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), rb_threadptr_to_kill(), rb_thread_struct::status, waiting_fd::th, thread_debug, thread_id_str, THREAD_KILLED, threadptr_check_pending_interrupt_queue(), rb_thread_struct::to_kill, and rb_thread_struct::vm.
Referenced by Init_Thread(), rb_thread_exit(), and rb_thread_s_kill().
VALUE rb_thread_list | ( | void | ) |
Definition at line 2484 of file thread.c.
References GET_THREAD, rb_vm_struct::living_threads, rb_ary_new(), rb_ary_push(), rb_thread_struct::self, rb_thread_struct::status, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by Init_Thread().
Definition at line 3049 of file thread.c.
References GetThreadPtr, waiting_fd::th, and threadptr_local_aref().
Referenced by detach_process_pid(), rb_thread_aref(), VpGetException(), VpGetPrecLimit(), and VpGetRoundMode().
Definition at line 3146 of file thread.c.
References GetThreadPtr, OBJ_FROZEN, rb_error_frozen(), waiting_fd::th, and threadptr_local_aset().
Referenced by rb_detach_process(), and rb_thread_aset().
VALUE rb_thread_main | ( | void | ) |
Definition at line 1908 of file thread.c.
References err, GetThreadPtr, rb_thread_struct::pending_interrupt_queue, Qfalse, Qtrue, rb_cModule, rb_eTypeError, rb_obj_is_kind_of(), rb_raise(), rb_scan_args(), rb_threadptr_pending_interrupt_empty_p(), and rb_threadptr_pending_interrupt_include_p().
Referenced by Init_Thread(), and rb_thread_s_pending_interrupt_p().
Definition at line 3395 of file thread.c.
References GetThreadPtr, INT2NUM, rb_thread_struct::priority, and waiting_fd::th.
Referenced by Init_Thread().
Definition at line 3430 of file thread.c.
References ALLOC, waiting_fd::fd, FD_CLR, FD_ISSET, FD_SET, GetThreadPtr, INT2NUM, max(), memcpy, MEMZERO, NULL, NUM2INT, rb_thread_struct::priority, rb_fd_clr, rb_fd_copy, rb_fd_dup, rb_fd_init, rb_fd_init_copy, rb_fd_isset, rb_fd_max, rb_fd_ptr, rb_fd_resize, rb_fd_select, rb_fd_set, rb_fd_term, rb_fd_zero, rb_w32_get_osfhandle(), RUBY_THREAD_PRIORITY_MAX, RUBY_THREAD_PRIORITY_MIN, select(), size, waiting_fd::th, xfree(), xmalloc, and xrealloc.
Referenced by Init_Thread().
Definition at line 2735 of file thread.c.
References GetThreadPtr, Qfalse, Qtrue, rb_thread_struct::report_on_exception, and waiting_fd::th.
Referenced by Init_Thread().
Definition at line 2757 of file thread.c.
References GetThreadPtr, rb_thread_struct::report_on_exception, RTEST, waiting_fd::th, and val.
Referenced by Init_Thread().
void rb_thread_reset_timer_thread | ( | void | ) |
Definition at line 4081 of file thread.c.
Referenced by after_exec_non_async_signal_safe().
Definition at line 2427 of file thread.c.
References rb_thread_schedule(), and rb_thread_wakeup().
Referenced by Init_Thread().
|
static |
Definition at line 2565 of file thread.c.
References GET_THREAD, Qfalse, and Qtrue.
Referenced by Init_Thread().
Definition at line 2602 of file thread.c.
References GET_THREAD, RTEST, and val.
Referenced by Init_Thread().
Definition at line 1852 of file thread.c.
References EXEC_TAG, GET_THREAD, handle_interrupt_arg_check_i(), OBJ_FREEZE_RAW, rb_thread_struct::pending_interrupt_mask_stack, rb_thread_struct::pending_interrupt_queue_checked, Qnil, rb_ary_pop(), rb_ary_push(), rb_block_given_p(), rb_convert_type(), rb_eArgError, rb_hash_foreach(), rb_raise(), rb_threadptr_pending_interrupt_empty_p(), rb_yield(), RUBY_VM_CHECK_INTS, RUBY_VM_SET_INTERRUPT, T_HASH, waiting_fd::th, TH_JUMP_TAG, TH_POP_TAG, and TH_PUSH_TAG.
Referenced by Init_Thread().
Definition at line 1996 of file thread.c.
References GET_THREAD, and rb_thread_pending_interrupt_p().
Referenced by Init_Thread().
|
static |
Definition at line 2675 of file thread.c.
References GET_THREAD, Qfalse, and Qtrue.
Referenced by Init_Thread().
Definition at line 2712 of file thread.c.
References GET_THREAD, RTEST, and val.
Referenced by Init_Thread().
Definition at line 2931 of file thread.c.
References GetThreadPtr, INT2NUM, rb_thread_struct::safe_level, and waiting_fd::th.
Referenced by Init_Thread().
void rb_thread_schedule | ( | void | ) |
Definition at line 1264 of file thread.c.
References GET_THREAD, rb_thread_schedule_limits(), and RUBY_VM_CHECK_INTS.
Referenced by io_close_fptr(), mustbe_callable(), rb_thread_fd_close(), rb_thread_run(), and thread_s_pass().
|
static |
Definition at line 1247 of file thread.c.
References GET_THREAD, RB_GC_SAVE_MACHINE_CONTEXT, rb_thread_alone(), rb_thread_set_current, rb_thread_struct::running_time_us, waiting_fd::th, thread_debug, and rb_thread_struct::vm.
Referenced by rb_thread_schedule(), and rb_threadptr_execute_interrupts().
Definition at line 2963 of file thread.c.
References GetThreadPtr, name, rb_thread_struct::name, NIL_P, rb_eArgError, rb_enc_asciicompat, rb_enc_get(), rb_enc_name, rb_raise(), rb_str_new_frozen(), RSTRING_PTR, StringValueCStr, waiting_fd::th, rb_thread_struct::thread_id, and threadptr_initialized.
Referenced by Init_Thread().
Definition at line 4466 of file thread.c.
References DATA_PTR, Qfalse, Qtrue, rb_mutex_unlock(), rb_thread_shield_waiting, and thread_shield_get_mutex().
Referenced by release_thread_shield().
VALUE rb_thread_shield_new | ( | void | ) |
Definition at line 4410 of file thread.c.
References DATA_PTR, rb_cThreadShield, rb_mutex_lock(), and thread_shield_alloc().
Referenced by load_lock().
Definition at line 4455 of file thread.c.
References Qfalse, Qtrue, rb_mutex_unlock(), rb_thread_shield_waiting, and thread_shield_get_mutex().
Referenced by release_thread_shield().
Definition at line 4426 of file thread.c.
References DATA_PTR, GET_THREAD, GetMutexPtr, GetThreadShieldPtr, Qfalse, Qnil, Qtrue, rb_mutex_lock(), rb_mutex_unlock(), rb_thread_shield_waiting, rb_thread_shield_waiting_dec(), rb_thread_shield_waiting_inc(), and rb_mutex_struct::th.
Referenced by load_lock().
|
inlinestatic |
Definition at line 4400 of file thread.c.
References rb_eRuntimeError, rb_raise(), rb_thread_shield_waiting, RBASIC, THREAD_SHIELD_WAITING_MASK, and THREAD_SHIELD_WAITING_SHIFT.
Referenced by rb_thread_shield_wait().
|
inlinestatic |
Definition at line 4389 of file thread.c.
References rb_eRuntimeError, rb_raise(), rb_thread_shield_waiting, RBASIC, THREAD_SHIELD_WAITING_MASK, and THREAD_SHIELD_WAITING_SHIFT.
Referenced by rb_thread_shield_wait().
void rb_thread_sleep | ( | int | sec | ) |
Definition at line 1241 of file thread.c.
References INT2FIX, rb_thread_wait_for(), and rb_time_timeval().
Referenced by pipe_open(), and rb_exec_async_signal_safe().
void rb_thread_sleep_deadly | ( | void | ) |
Definition at line 1163 of file thread.c.
References GET_THREAD, sleep_forever(), thread_debug, and TRUE.
Referenced by autoload_sleep(), and rb_thread_stop().
|
static |
Definition at line 1170 of file thread.c.
References FALSE, GET_THREAD, sleep_forever(), thread_debug, and TRUE.
Referenced by queue_sleep(), and rb_mutex_sleep_forever().
void rb_thread_sleep_forever | ( | void | ) |
Definition at line 1156 of file thread.c.
References FALSE, GET_THREAD, sleep_forever(), thread_debug, and TRUE.
Referenced by rb_f_sleep(), and rb_thread_fd_select().
void rb_thread_start_timer_thread | ( | void | ) |
Definition at line 4087 of file thread.c.
References GET_THREAD, INT2FIX, rb_thread_struct::join_list, key, rb_vm_struct::living_threads, rb_vm_struct::main_thread, NULL, Qnil, RARRAY_AREF, RARRAY_ASET, RARRAY_LEN, rb_get_coverages(), rb_hash_tbl_raw(), rb_reset_random_seed(), rb_thread_atfork(), rb_thread_atfork_before_exec(), rb_vm_living_threads_init(), rb_vm_living_threads_insert(), RTEST, rb_vm_struct::sleeper, ST_CONTINUE, st_data_t, st_foreach, system_working, waiting_fd::th, thread_cleanup_func(), thread_cleanup_func_before_exec(), TRUE, val, and rb_thread_struct::vm.
Referenced by after_exec_non_async_signal_safe().
|
static |
Definition at line 2850 of file thread.c.
References rb_thread_struct::errinfo, FALSE, FIXNUM_P, GetThreadPtr, NIL_P, Qfalse, Qnil, rb_str_new2, rb_threadptr_dead(), waiting_fd::th, and thread_status_name().
VALUE rb_thread_stop | ( | void | ) |
Definition at line 2451 of file thread.c.
References Qnil, rb_eThreadError, rb_raise(), rb_thread_alone(), and rb_thread_sleep_deadly().
Referenced by Init_Thread().
Definition at line 2906 of file thread.c.
References GetThreadPtr, Qfalse, Qtrue, rb_threadptr_dead(), rb_thread_struct::status, waiting_fd::th, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by Init_Thread().
void rb_thread_stop_timer_thread | ( | void | ) |
Definition at line 4073 of file thread.c.
Referenced by before_exec_non_async_signal_safe(), and ruby_cleanup().
void rb_thread_terminate_all | ( | void | ) |
Definition at line 472 of file thread.c.
References GET_THREAD, rb_vm_struct::main_thread, rb_bug(), rb_threadptr_unlock_all_locking_mutexes(), RUBY_VM_CHECK_INTS_BLOCKING, terminate_all(), waiting_fd::th, TH_EXEC_TAG, TH_POP_TAG, TH_PUSH_TAG, thread_debug, rb_thread_struct::vm, and vm_living_thread_num().
Referenced by ruby_cleanup().
int rb_thread_to_be_killed | ( | VALUE | thread | ) |
Definition at line 2311 of file thread.c.
References FALSE, GetThreadPtr, rb_thread_struct::status, waiting_fd::th, THREAD_KILLED, rb_thread_struct::to_kill, and TRUE.
Referenced by autoload_sleep_done(), and pipe_close().
Definition at line 3206 of file thread.c.
References id_locals, rb_hash_aref(), rb_ivar_get(), and rb_to_symbol().
Referenced by Init_Thread().
Definition at line 3360 of file thread.c.
References ID2SYM, id_locals, Qfalse, Qtrue, rb_check_id(), rb_ivar_get(), RHASH, and st_lookup.
Referenced by Init_Thread().
Definition at line 3224 of file thread.c.
References id_locals, OBJ_FROZEN, rb_error_frozen(), rb_hash_aset(), rb_ivar_get(), and rb_to_symbol().
Referenced by Init_Thread().
Definition at line 3331 of file thread.c.
References id_locals, keys_i(), rb_ary_new(), rb_hash_foreach(), and rb_ivar_get().
Referenced by Init_Thread().
void rb_thread_wait_fd | ( | int | fd | ) |
Definition at line 3782 of file thread.c.
References rb_thread_wait_fd_rw().
Referenced by open_load_file(), ossl_ssl_read_internal(), rb_io_read_check(), rb_io_sysread(), and rb_io_wait_readable().
|
static |
Definition at line 3762 of file thread.c.
References NULL, rb_eIOError, rb_raise(), rb_sys_fail(), rb_wait_for_single_fd(), RB_WAITFD_IN, RB_WAITFD_OUT, result, and thread_debug.
Referenced by rb_thread_fd_writable(), and rb_thread_wait_fd().
void rb_thread_wait_for | ( | struct timeval | time | ) |
Definition at line 1201 of file thread.c.
References GET_THREAD, sleep_timeval(), and waiting_fd::th.
Referenced by rb_f_sleep(), rb_file_flock(), rb_thread_fd_select(), and rb_thread_sleep().
Definition at line 2381 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 2390 of file thread.c.
References GetThreadPtr, Qnil, rb_threadptr_ready(), rb_thread_struct::status, waiting_fd::th, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by autoload_reset(), rb_szqueue_max_set(), rb_thread_wakeup(), wakeup_all_threads(), and wakeup_first_thread().
void rb_threadptr_check_signal | ( | rb_thread_t * | mth | ) |
Definition at line 4032 of file thread.c.
References rb_signal_buff_size(), and rb_threadptr_trap_interrupt().
Referenced by rb_f_kill(), ruby_cleanup(), and timer_thread_function().
|
static |
Definition at line 2812 of file thread.c.
References rb_thread_struct::status, and THREAD_KILLED.
Referenced by rb_thread_alive_p(), rb_thread_status(), rb_thread_stop_p(), and rb_threadptr_raise().
void rb_threadptr_execute_interrupts | ( | rb_thread_t * | th, |
int | blocking_timing | ||
) |
Definition at line 2025 of file thread.c.
References rb_thread_struct::cfp, eKillSignal, err, eTerminateSignal, EXEC_EVENT_HOOK, 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_thread_struct::raised_flag, rb_exc_raise(), rb_get_next_signal(), rb_postponed_job_flush(), rb_signal_exec(), rb_thread_schedule_limits(), rb_threadptr_pending_interrupt_active_p(), rb_threadptr_pending_interrupt_deque(), rb_threadptr_to_kill(), RUBY_INTERNAL_EVENT_SWITCH, rb_thread_struct::running_time_us, rb_control_frame_struct::self, rb_thread_struct::status, TAG_FATAL, thread_debug, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, threadptr_get_interrupts(), TIMER_INTERRUPT_MASK, TRAP_INTERRUPT_MASK, and rb_thread_struct::vm.
Referenced by rb_thread_execute_interrupts(), ruby_vm_check_ints(), and vm_check_ints_blocking().
void rb_threadptr_interrupt | ( | rb_thread_t * | th | ) |
Definition at line 426 of file thread.c.
References rb_threadptr_interrupt_common().
Referenced by rb_notify_fd_close(), rb_thread_kill(), rb_threadptr_raise(), rb_threadptr_ready(), ruby_cleanup(), terminate_all(), and thread_start_func_2().
|
static |
Definition at line 408 of file thread.c.
References rb_unblock_callback::arg, rb_unblock_callback::func, rb_thread_struct::interrupt_cond, rb_thread_struct::interrupt_lock, RUBY_VM_SET_INTERRUPT, RUBY_VM_SET_TRAP_INTERRUPT, and rb_thread_struct::unblock.
Referenced by rb_threadptr_interrupt(), and rb_threadptr_trap_interrupt().
int rb_threadptr_pending_interrupt_active_p | ( | rb_thread_t * | th | ) |
Definition at line 1710 of file thread.c.
References rb_thread_struct::pending_interrupt_queue_checked, and rb_threadptr_pending_interrupt_empty_p().
Referenced by rb_threadptr_execute_interrupts().
|
static |
Definition at line 1615 of file thread.c.
References INTERRUPT_IMMEDIATE, INTERRUPT_NEVER, INTERRUPT_NONE, INTERRUPT_ON_BLOCKING, rb_thread_struct::pending_interrupt_mask_stack, Qnil, RARRAY_CONST_PTR, RARRAY_LEN, rb_eThreadError, rb_hash_aref(), rb_mod_ancestors(), rb_raise(), sym, sym_immediate, sym_never, and sym_on_blocking.
Referenced by rb_threadptr_pending_interrupt_deque().
void rb_threadptr_pending_interrupt_clear | ( | rb_thread_t * | th | ) |
Definition at line 1587 of file thread.c.
References rb_thread_struct::pending_interrupt_queue, and rb_ary_clear().
Referenced by rb_threadptr_to_kill().
|
static |
Definition at line 1673 of file thread.c.
References CLASS_OF, err, INTERRUPT_IMMEDIATE, INTERRUPT_NEVER, INTERRUPT_NONE, INTERRUPT_ON_BLOCKING, rb_thread_struct::pending_interrupt_queue, rb_thread_struct::pending_interrupt_queue_checked, Qundef, RARRAY_AREF, RARRAY_LEN, rb_ary_delete_at(), rb_ary_shift(), rb_threadptr_pending_interrupt_check_mask(), and rb_threadptr_pending_interrupt_empty_p().
Referenced by rb_threadptr_execute_interrupts().
|
static |
Definition at line 1654 of file thread.c.
References rb_thread_struct::pending_interrupt_queue, and RARRAY_LEN.
Referenced by rb_thread_pending_interrupt_p(), rb_thread_s_handle_interrupt(), rb_threadptr_pending_interrupt_active_p(), rb_threadptr_pending_interrupt_deque(), and vm_check_ints_blocking().
void rb_threadptr_pending_interrupt_enque | ( | rb_thread_t * | th, |
VALUE | v | ||
) |
Definition at line 1593 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(), rb_thread_kill(), rb_threadptr_raise(), and terminate_all().
|
static |
Definition at line 1660 of file thread.c.
References FALSE, rb_thread_struct::pending_interrupt_queue, RARRAY_AREF, RARRAY_LEN, rb_class_inherited_p(), and TRUE.
Referenced by rb_thread_pending_interrupt_p().
|
static |
Definition at line 2114 of file thread.c.
References GET_THREAD, Qnil, Qundef, rb_eRuntimeError, rb_exc_new(), rb_make_exception(), rb_threadptr_dead(), rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), and rb_threadptr_setup_exception().
Referenced by rb_check_deadlock(), rb_threadptr_signal_exit(), rb_threadptr_signal_raise(), thread_cleanup_func(), thread_raise_m(), and thread_start_func_2().
|
static |
Definition at line 2106 of file thread.c.
References rb_threadptr_interrupt(), rb_threadptr_setup_exception(), and waiting_fd::th.
Referenced by rb_thread_wakeup_alive().
int rb_threadptr_reset_raised | ( | rb_thread_t * | th | ) |
Definition at line 2190 of file thread.c.
References RAISED_EXCEPTION, and rb_thread_struct::raised_flag.
Referenced by error_handle(), exec_hooks_protected(), rb_suppress_tracing(), and setup_exception().
int rb_threadptr_set_raised | ( | rb_thread_t * | th | ) |
Definition at line 2180 of file thread.c.
References RAISED_EXCEPTION, and rb_thread_struct::raised_flag.
Referenced by error_handle(), exec_hooks_protected(), rb_suppress_tracing(), and setup_exception().
void rb_threadptr_setup_exception | ( | rb_thread_t * | th, |
VALUE | mesg, | ||
VALUE | cause | ||
) |
Definition at line 598 of file eval.c.
References get_thread_errinfo(), Qundef, and rb_ivar_set().
Referenced by rb_threadptr_raise(), and rb_threadptr_ready().
void rb_threadptr_signal_exit | ( | rb_thread_t * | th | ) |
Definition at line 2152 of file thread.c.
References argv, rb_vm_struct::main_thread, NORETURN(), rb_eSystemExit, rb_str_new2, rb_threadptr_raise(), ruby_thread_stack_overflow(), and rb_thread_struct::vm.
Referenced by rb_signal_exec().
void rb_threadptr_signal_raise | ( | rb_thread_t * | th, |
int | sig | ||
) |
Definition at line 2142 of file thread.c.
References argv, INT2FIX, rb_vm_struct::main_thread, rb_eSignal, rb_threadptr_raise(), and rb_thread_struct::vm.
Referenced by rb_signal_exec().
|
static |
Definition at line 2002 of file thread.c.
References rb_thread_struct::errinfo, INT2FIX, rb_threadptr_pending_interrupt_clear(), rb_thread_struct::status, TAG_FATAL, TH_JUMP_TAG, THREAD_RUNNABLE, and rb_thread_struct::to_kill.
Referenced by rb_thread_kill(), and rb_threadptr_execute_interrupts().
void rb_threadptr_trap_interrupt | ( | rb_thread_t * | th | ) |
Definition at line 432 of file thread.c.
References rb_threadptr_interrupt_common().
Referenced by rb_threadptr_check_signal().
void rb_threadptr_unlock_all_locking_mutexes | ( | rb_thread_t * | th | ) |
Definition at line 455 of file thread.c.
References err, rb_thread_struct::keeping_mutexes, rb_mutex_struct::next_mutex, rb_bug(), and rb_mutex_unlock_th().
Referenced by rb_thread_terminate_all(), ruby_cleanup(), and thread_start_func_2().
Definition at line 5035 of file thread.c.
References GET_THREAD, rb_thread_struct::interrupt_mask, OBJ_FREEZE_RAW, rb_thread_struct::pending_interrupt_mask_stack, rb_ary_pop(), rb_ary_push(), rb_cObject, rb_ensure(), rb_hash_aset(), rb_ident_hash_new(), and sym_never.
Referenced by rb_f_p().
VALUE rb_vm_backtrace_str_ary | ( | rb_thread_t * | th, |
long | lev, | ||
long | n | ||
) |
Definition at line 659 of file vm_backtrace.c.
References backtrace_object(), and backtrace_to_str_ary().
Referenced by debug_deadlock_check(), rb_make_backtrace(), and ruby_native_thread_p().
void rb_vm_gvl_destroy | ( | rb_vm_t * | vm | ) |
Definition at line 342 of file thread.c.
References rb_vm_struct::thread_destruct_lock.
Referenced by ruby_vm_destruct().
Definition at line 558 of file thread.c.
References NULL, rb_vm_ep_local_ep(), and vm_proc_ep().
Referenced by rb_fiber_start(), thread_do_start(), and VM_STACK_ENV_WRITE().
int rb_wait_for_single_fd | ( | int | fd, |
int | events, | ||
struct timeval * | tv | ||
) |
Definition at line 3992 of file thread.c.
References select_args::as, errno, select_args::error, select_args::except, waiting_fd::fd, select_args::fd, init_set_fd(), NULL, rb_ensure(), RB_WAITFD_IN, RB_WAITFD_OUT, RB_WAITFD_PRI, select_args::read, select_single(), select_single_cleanup(), select_args::tv, and select_args::write.
Referenced by mustbe_callable(), rb_thread_fd_select(), rb_thread_wait_fd_rw(), wait_connectable(), and wait_for_single_fd().
Definition at line 4522 of file thread.c.
References NIL_P, OBJ_ID_EQL, Qfalse, Qtrue, Qundef, rb_hash_lookup(), rb_hash_lookup2(), RB_TYPE_P, and T_HASH.
Referenced by exec_recursive().
Definition at line 4495 of file thread.c.
References GET_THREAD, hash(), list, NIL_P, Qnil, rb_hash_aref(), rb_hash_aset(), rb_hash_new(), rb_ident_hash_new(), RB_TYPE_P, T_HASH, threadptr_recursive_hash(), and threadptr_recursive_hash_set().
Referenced by exec_recursive().
Definition at line 4587 of file thread.c.
References Qundef, rb_hash_delete_entry(), rb_hash_lookup2(), RB_TYPE_P, RHASH_EMPTY_P, and T_HASH.
Referenced by exec_recursive().
Definition at line 4557 of file thread.c.
References Qtrue, Qundef, rb_hash_aset(), rb_hash_lookup2(), rb_hash_new(), RB_TYPE_P, and T_HASH.
Referenced by exec_recursive().
Definition at line 838 of file thread.c.
References rb_thread_struct::join_list, rb_thread_list_struct::next, Qnil, rb_thread_struct::status, join_arg::target, waiting_fd::th, THREAD_KILLED, and join_arg::waiting.
Referenced by thread_join().
Definition at line 5018 of file thread.c.
References coverage(), rb_ary_clear(), and ST_CONTINUE.
Referenced by rb_reset_coverages().
|
static |
Definition at line 400 of file thread.c.
References rb_thread_struct::interrupt_lock, and rb_thread_struct::unblock.
Referenced by blocking_region_end(), and rb_mutex_lock().
|
inlinestatic |
Definition at line 3681 of file thread.c.
Referenced by do_select(), and rb_thread_fd_select().
void ruby_kill | ( | rb_pid_t | pid, |
int | sig | ||
) |
Definition at line 5048 of file thread.c.
References err, GET_THREAD, GVL_UNLOCK_BEGIN, GVL_UNLOCK_END, rb_thread_struct::interrupt_cond, rb_thread_struct::interrupt_lock, kill(), and rb_sys_fail().
Referenced by rb_f_kill().
int ruby_native_thread_p | ( | void | ) |
Definition at line 4900 of file thread.c.
References rb_vm_backtrace_str_ary().
Referenced by garbage_collect_with_gvl(), negative_size_allocation_error(), objspace_malloc_gc_stress(), objspace_malloc_increase(), and ruby_memerror().
int ruby_thread_has_gvl_p | ( | void | ) |
Definition at line 1541 of file thread.c.
References rb_thread_struct::blocking_region_buffer, and waiting_fd::th.
Referenced by callback(), garbage_collect_with_gvl(), negative_size_allocation_error(), objspace_malloc_increase(), and ruby_memerror().
void ruby_thread_init_stack | ( | rb_thread_t * | th | ) |
Definition at line 552 of file thread.c.
Referenced by Init_BareVM().
void ruby_thread_stack_overflow | ( | rb_thread_t * | th | ) |
Definition at line 2167 of file thread.c.
References rb_thread_struct::errinfo, rb_thread_struct::raised_flag, rb_during_gc(), rb_exc_raise(), sysstack_error, TAG_RAISE, and TH_JUMP_TAG.
Referenced by rb_threadptr_signal_exit().
Definition at line 3958 of file thread.c.
References select_args::as, errno, select_args::error, select_args::except, select_args::fd, rb_fd_isset, rb_thread_fd_select(), RB_WAITFD_IN, RB_WAITFD_OUT, RB_WAITFD_PRI, select_args::read, select_args::tv, and select_args::write.
Referenced by rb_wait_for_single_fd().
Definition at line 3980 of file thread.c.
References select_args::except, rb_fd_term, select_args::read, and select_args::write.
Referenced by rb_wait_for_single_fd().
|
static |
Definition at line 374 of file thread.c.
References rb_unblock_callback::arg, FALSE, func, rb_unblock_callback::func, rb_thread_struct::interrupt_lock, RUBY_VM_CHECK_INTS, RUBY_VM_INTERRUPTED_ANY, TRUE, and rb_thread_struct::unblock.
Referenced by blocking_region_begin(), and rb_mutex_lock().
|
static |
Definition at line 1073 of file thread.c.
References rb_check_deadlock(), RUBY_VM_CHECK_INTS_BLOCKING, rb_vm_struct::sleeper, rb_thread_struct::status, THREAD_STOPPED, THREAD_STOPPED_FOREVER, and rb_thread_struct::vm.
Referenced by rb_thread_sleep_deadly(), rb_thread_sleep_deadly_allow_spurious_wakeup(), rb_thread_sleep_forever(), and thread_join_sleep().
|
static |
Definition at line 1114 of file thread.c.
References getclockofday(), PRI_TIMET_PREFIX, RUBY_VM_CHECK_INTS_BLOCKING, rb_thread_struct::status, thread_debug, THREAD_STOPPED, timeval::tv_sec, and timeval::tv_usec.
Referenced by rb_mutex_wait_for(), rb_thread_wait_for(), and sleep_wait_for_interrupt().
|
static |
Definition at line 1195 of file thread.c.
References double2timeval(), and sleep_timeval().
Referenced by thread_join_sleep().
Definition at line 105 of file thread.c.
References st_delete.
Referenced by threadptr_local_aset().
|
static |
Definition at line 438 of file thread.c.
References eTerminateSignal, rb_vm_struct::living_threads, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), waiting_fd::th, and thread_debug.
Referenced by rb_thread_terminate_all().
Definition at line 4330 of file thread.c.
References thgroup::enclosed, GetThreadPtr, thgroup::group, OBJ_FROZEN, Qnil, rb_eThreadError, rb_raise(), waiting_fd::th, rb_thread_struct::thgroup, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 4273 of file thread.c.
References thgroup::enclosed, thgroup::group, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 4292 of file thread.c.
References thgroup::enclosed, Qfalse, Qtrue, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 4241 of file thread.c.
References GET_THREAD, rb_vm_struct::living_threads, rb_ary_new(), rb_ary_push(), rb_thread_struct::self, and rb_thread_struct::thgroup.
Referenced by Init_Thread().
Definition at line 4219 of file thread.c.
References thgroup::enclosed, thgroup::group, and TypedData_Make_Struct.
Referenced by Init_Thread().
|
static |
Definition at line 529 of file thread.c.
References rb_thread_struct::interrupt_lock, rb_thread_struct::locking_mutex, Qfalse, rb_thread_inspect(), rb_threadptr_raise(), waiting_fd::th, and thread_cleanup_func_before_exec().
Referenced by rb_thread_start_timer_thread(), and thread_start_func_2().
|
static |
Definition at line 518 of file thread.c.
References rb_thread_struct::machine, rb_thread_struct::stack_end, rb_thread_struct::stack_start, rb_thread_struct::status, waiting_fd::th, and THREAD_KILLED.
Referenced by rb_thread_start_timer_thread(), and thread_cleanup_func().
Definition at line 705 of file thread.c.
References err, rb_thread_struct::first_args, rb_thread_struct::first_func, rb_thread_struct::first_proc, GET_THREAD, GetThreadPtr, rb_thread_struct::interrupt_cond, rb_thread_struct::interrupt_lock, rb_thread_struct::interrupt_mask, OBJ_FROZEN, rb_thread_struct::pending_interrupt_mask_stack, rb_thread_struct::pending_interrupt_queue, rb_thread_struct::pending_interrupt_queue_checked, rb_thread_struct::priority, Qfalse, rb_ary_dup(), rb_ary_tmp_new(), rb_block_proc(), rb_eThreadError, rb_raise(), rb_vm_living_threads_insert(), RBASIC_CLEAR_CLASS, rb_thread_struct::report_on_exception, rb_thread_struct::status, strerror(), waiting_fd::th, rb_thread_struct::thgroup, THREAD_KILLED, rb_vm_struct::thread_report_on_exception, and rb_thread_struct::vm.
Referenced by rb_thread_create(), thread_initialize(), and thread_start().
|
static |
Definition at line 571 of file thread.c.
References rb_thread_struct::errinfo, EXEC_EVENT_HOOK, rb_thread_struct::first_func, rb_thread_struct::first_proc, GetProcPtr, Qfalse, Qnil, Qundef, RARRAY_CONST_PTR, RARRAY_LEN, rb_vm_invoke_proc(), rb_vm_proc_local_ep(), rb_thread_struct::root_lep, rb_thread_struct::root_svar, RUBY_EVENT_THREAD_BEGIN, RUBY_EVENT_THREAD_END, rb_thread_struct::self, rb_thread_struct::value, and VM_BLOCK_HANDLER_NONE.
Referenced by thread_start_func_2().
Definition at line 803 of file thread.c.
References rb_thread_struct::first_args, rb_thread_struct::first_proc, GetThreadPtr, PRIsVALUE, RARRAY_AREF, rb_block_given_p(), rb_eThreadError, rb_proc_location(), rb_raise(), RTEST, waiting_fd::th, and thread_create_core().
Referenced by Init_Thread().
|
static |
Definition at line 886 of file thread.c.
References join_arg::delay, err, rb_thread_struct::errinfo, FIX2INT, FIXNUM_P, GET_THREAD, GET_VM, INT2FIX, rb_thread_struct::join_list, list, rb_thread_list_struct::next, PRI_THREAD_ID, Qnil, rb_bug(), rb_ensure(), rb_eThreadError, rb_exc_raise(), rb_raise(), remove_from_join_list(), rb_thread_struct::self, rb_thread_struct::status, TAG_FATAL, join_arg::target, waiting_fd::th, rb_thread_list_struct::th, thread_debug, thread_id_str, thread_join_sleep(), THREAD_KILLED, THROW_DATA_P, and join_arg::waiting.
Referenced by thread_join_m(), and thread_value().
Definition at line 981 of file thread.c.
References join_arg::delay, DELAY_INFTY, GetThreadPtr, NIL_P, rb_num2dbl(), rb_scan_args(), and thread_join().
Referenced by Init_Thread().
Definition at line 859 of file thread.c.
References join_arg::delay, DELAY_INFTY, FALSE, PRI_THREAD_ID, Qfalse, Qtrue, sleep_forever(), sleep_wait_for_interrupt(), rb_thread_struct::status, join_arg::target, waiting_fd::th, thread_debug, thread_id_str, THREAD_KILLED, timeofday(), TRUE, and join_arg::waiting.
Referenced by thread_join().
Definition at line 3267 of file thread.c.
References ID2SYM, rb_ary_push(), and ST_CONTINUE.
Referenced by rb_thread_keys().
Definition at line 2253 of file thread.c.
References GET_THREAD, GetThreadPtr, Qnil, rb_threadptr_raise(), RUBY_VM_CHECK_INTS, and threadptr_check_pending_interrupt_queue().
Referenced by Init_Thread().
Definition at line 2519 of file thread.c.
References rb_thread_current().
Referenced by Init_Thread().
Definition at line 768 of file thread.c.
References GET_VM, GetThreadPtr, PRIsVALUE, rb_eThreadError, rb_obj_call_init(), rb_raise(), rb_thread_alloc(), waiting_fd::th, THREAD_KILLED, and threadptr_initialized.
Referenced by Init_Thread().
Definition at line 1562 of file thread.c.
References Qnil, and rb_thread_schedule().
Referenced by Init_Thread().
Definition at line 4378 of file thread.c.
References mutex_alloc(), and TypedData_Wrap_Struct.
Referenced by rb_thread_shield_new().
Definition at line 4443 of file thread.c.
References GetThreadShieldPtr, rb_eThreadError, and rb_raise().
Referenced by rb_thread_shield_destroy(), and rb_thread_shield_release().
|
static |
Definition at line 4366 of file thread.c.
References rb_gc_mark().
Definition at line 796 of file thread.c.
References rb_thread_alloc(), and thread_create_core().
Referenced by Init_Thread().
|
static |
Definition at line 592 of file thread.c.
References EXEC_TAG, FALSE, rb_thread_struct::first_args, rb_thread_struct::machine, rb_vm_struct::main_thread, rb_thread_list_struct::next, NULL, PRIxVALUE, Qfalse, Qnil, rb_bug(), rb_check_deadlock(), rb_eSystemExit, rb_obj_is_kind_of(), rb_str_cat_cstr(), rb_thread_alone(), rb_thread_inspect(), rb_thread_recycle_stack_release(), rb_thread_set_current, rb_threadptr_error_print(), rb_threadptr_interrupt(), rb_threadptr_raise(), rb_threadptr_unlock_all_locking_mutexes(), RB_TYPE_P, rb_vm_living_threads_remove(), rb_write_error_str(), RTEST, ruby_debug, ruby_stop(), SAVE_ROOT_JMPBUF, rb_thread_struct::stack_start, rb_thread_struct::status, T_OBJECT, TAG_FATAL, rb_thread_list_struct::th, TH_POP_TAG, TH_PUSH_TAG, thread_cleanup_func(), thread_debug, thread_do_start(), THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, and rb_thread_struct::vm.
|
static |
Definition at line 2792 of file thread.c.
References rb_thread_struct::status, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, and rb_thread_struct::to_kill.
Referenced by rb_thread_inspect(), and rb_thread_status().
Definition at line 1012 of file thread.c.
References DELAY_INFTY, GetThreadPtr, waiting_fd::th, thread_join(), and rb_thread_struct::value.
Referenced by Init_Thread().
|
static |
Definition at line 1600 of file thread.c.
References rb_thread_struct::pending_interrupt_queue, rb_eThreadError, and rb_raise().
Referenced by rb_thread_kill(), and thread_raise_m().
|
inlinestatic |
Definition at line 2012 of file thread.c.
References ATOMIC_CAS, rb_thread_struct::interrupt_flag, and rb_thread_struct::interrupt_mask.
Referenced by rb_threadptr_execute_interrupts().
|
static |
Definition at line 3031 of file thread.c.
References rb_thread_struct::local_storage, rb_thread_struct::local_storage_recursive_hash, Qnil, st_data_t, st_lookup, and val.
Referenced by rb_thread_local_aref().
|
static |
Definition at line 3125 of file thread.c.
References rb_thread_struct::local_storage, rb_thread_struct::local_storage_recursive_hash, NIL_P, Qnil, st_delete_wrap(), st_init_numtable, st_insert, and val.
Referenced by rb_thread_local_aset().
|
static |
Definition at line 4475 of file thread.c.
References rb_thread_struct::local_storage_recursive_hash.
Referenced by recursive_list_access().
|
static |
Definition at line 4481 of file thread.c.
References hash(), rb_thread_struct::local_storage_recursive_hash, and rb_frame_last_func().
Referenced by recursive_list_access().
|
static |
Definition at line 1177 of file thread.c.
References clock_gettime(), CLOCK_MONOTONIC, gettimeofday(), NULL, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
Referenced by do_select(), rb_thread_fd_select(), thread_join_sleep(), and update_timeval().
|
static |
Definition at line 4042 of file thread.c.
References GET_VM, rb_vm_struct::main_thread, rb_threadptr_check_signal(), RUBY_VM_SET_TIMER_INTERRUPT, rb_vm_struct::running_thread, and rb_vm_struct::thread_destruct_lock.
|
static |
Definition at line 4984 of file thread.c.
References rb_thread_struct::cfp, count, coverage(), FIX2LONG, FIXNUM_P, GET_THREAD, rb_control_frame_struct::iseq, LONG2FIX, POSFIXABLE, RARRAY_AREF, RARRAY_ASET, RARRAY_LEN, rb_iseq_coverage(), rb_sourceline(), RB_TYPE_P, RBASIC_CLASS, and T_ARRAY.
Referenced by rb_reset_coverages(), and rb_set_coverages().
|
inlinestatic |
Definition at line 3694 of file thread.c.
References timeofday(), timeval::tv_sec, and timeval::tv_usec.
|
inlinestatic |
Definition at line 173 of file thread.c.
References LIKELY, rb_thread_struct::pending_interrupt_queue_checked, rb_threadptr_execute_interrupts(), rb_threadptr_pending_interrupt_empty_p(), RUBY_VM_INTERRUPTED_ANY, and RUBY_VM_SET_INTERRUPT.
|
static |
Definition at line 187 of file thread.c.
References buf, fill_thread_id_string, INT2NUM, rb_vm_struct::living_thread_num, NUM2INT, RTEST, ruby_digitmap, and val.
Referenced by debug_deadlock_check(), rb_check_deadlock(), rb_mutex_lock(), rb_thread_alone(), and rb_thread_terminate_all().
|
static |
Definition at line 83 of file thread.c.
Referenced by Init_Thread(), rb_thread_variable_get(), rb_thread_variable_p(), rb_thread_variable_set(), and rb_thread_variables().
|
static |
Definition at line 78 of file thread.c.
Referenced by rb_thread_shield_new().
|
static |
Definition at line 80 of file thread.c.
Referenced by handle_interrupt_arg_check_i(), Init_Thread(), and rb_threadptr_pending_interrupt_check_mask().
|
static |
Definition at line 82 of file thread.c.
Referenced by handle_interrupt_arg_check_i(), Init_Thread(), rb_threadptr_pending_interrupt_check_mask(), and rb_uninterruptible().
|
static |
Definition at line 81 of file thread.c.
Referenced by handle_interrupt_arg_check_i(), Init_Thread(), and rb_threadptr_pending_interrupt_check_mask().
|
static |
Definition at line 96 of file thread.c.
Referenced by rb_thread_start_timer_thread().
|
static |
|
static |