Ruby
2.1.10p492(2016-04-01revision54464)
|
#include "eval_intern.h"
#include "gc.h"
#include "timev.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "internal.h"
Go to the source code of this file.
Data Structures | |
struct | rb_blocking_region_buffer |
struct | rb_mutex_struct |
struct | join_arg |
struct | select_args |
struct | thgroup |
struct | thgroup_list_params |
struct | exec_recursive_params |
Typedefs | |
typedef struct rb_mutex_struct | rb_mutex_t |
Enumerations | |
enum | handle_interrupt_timing { INTERRUPT_NONE, INTERRUPT_IMMEDIATE, INTERRUPT_ON_BLOCKING, INTERRUPT_NEVER } |
Variables | |
VALUE | rb_cMutex |
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 const rb_data_type_t | thgroup_data_type |
static const rb_data_type_t | mutex_data_type |
static const rb_thread_t * | patrol_thread = NULL |
static const rb_data_type_t | thread_shield_data_type |
static ID | recursive_key |
const struct st_hash_type | st_hashtype_num |
#define BLOCKING_REGION | ( | exec, | |
ubf, | |||
ubfarg, | |||
fail_if_interrupted | |||
) |
Definition at line 151 of file thread.c.
Referenced by call_without_gvl(), do_select(), and rb_thread_io_blocking_region().
#define closed_stream_error GET_VM()->special_exceptions[ruby_error_closed_stream] |
Definition at line 97 of file thread.c.
Referenced by Init_Thread().
#define DELAY_INFTY 1E30 |
Definition at line 752 of file thread.c.
Referenced by thread_join(), thread_join_m(), and thread_value().
#define eKillSignal INT2FIX(0) |
Definition at line 93 of file thread.c.
Referenced by rb_thread_kill(), and rb_threadptr_execute_interrupts().
#define eTerminateSignal INT2FIX(1) |
Definition at line 94 of file thread.c.
Referenced by rb_threadptr_execute_interrupts(), and terminate_i().
#define GetMutexPtr | ( | obj, | |
tobj | |||
) | TypedData_Get_Struct((obj), rb_mutex_t, &mutex_data_type, (tobj)) |
Definition at line 4186 of file thread.c.
Referenced by check_deadlock_i(), mutex_locked(), rb_mutex_abandon_locking_mutex(), rb_mutex_allow_trap(), rb_mutex_lock(), rb_mutex_locked_p(), rb_mutex_owned_p(), rb_mutex_trylock(), rb_mutex_unlock(), and rb_thread_shield_wait().
#define GetThreadShieldPtr | ( | obj | ) | ((VALUE)rb_check_typeddata((obj), &thread_shield_data_type)) |
Definition at line 4675 of file thread.c.
Referenced by rb_thread_shield_destroy(), rb_thread_shield_release(), and rb_thread_shield_wait().
#define GVL_UNLOCK_BEGIN | ( | ) |
Definition at line 136 of file thread.c.
Referenced by rb_mutex_lock(), and ruby_kill().
#define GVL_UNLOCK_END | ( | ) |
Definition at line 141 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 rb_fd_rcopy | ( | d, | |
s | |||
) | (*(d) = *(s)) |
Definition at line 3422 of file thread.c.
Referenced by rb_thread_select().
#define RB_GC_SAVE_MACHINE_CONTEXT | ( | th | ) |
Definition at line 128 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(), and Init_Thread().
#define rb_thread_shield_waiting | ( | b | ) | (int)((RBASIC(b)->flags&THREAD_SHIELD_WAITING_MASK)>>THREAD_SHIELD_WAITING_SHIFT) |
Definition at line 4678 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 RUBY_THREAD_PRIORITY_MAX 3 |
Definition at line 69 of file thread.c.
Referenced by rb_thread_priority_set().
#define RUBY_THREAD_PRIORITY_MIN -3 |
Definition at line 70 of file thread.c.
Referenced by rb_thread_priority_set().
#define thread_debug if(0)printf |
Definition at line 210 of file thread.c.
Referenced by blocking_region_begin(), blocking_region_end(), rb_thread_alone(), rb_thread_kill(), rb_thread_schedule_limits(), rb_thread_sleep_deadly(), rb_thread_sleep_forever(), rb_thread_terminate_all(), rb_thread_wait_fd_rw(), rb_threadptr_execute_interrupts(), sleep_timeval(), terminate_i(), thread_join(), thread_join_sleep(), and thread_start_func_2().
#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 4676 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 4677 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) |
typedef struct rb_mutex_struct rb_mutex_t |
|
inlinestatic |
Definition at line 1204 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_blocking_region_begin(), and rb_thread_call_with_gvl().
|
inlinestatic |
Definition at line 1222 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_blocking_region_end(), and rb_thread_call_with_gvl().
|
static |
Definition at line 1256 of file thread.c.
References BLOCKING_REGION, errno, func, GET_THREAD(), RUBY_UBF_IO, RUBY_UBF_PROCESS, RUBY_VM_CHECK_INTS_BLOCKING, val, and rb_thread_struct::waiting_fd.
Referenced by rb_thread_call_without_gvl(), and rb_thread_call_without_gvl2().
Definition at line 5208 of file thread.c.
References rb_mutex_struct::cond_waiting, GetMutexPtr, GetThreadPtr, key, rb_mutex_struct::lock, rb_thread_struct::locking_mutex, RUBY_VM_INTERRUPTED, ST_CONTINUE, ST_STOP, rb_thread_struct::status, rb_mutex_struct::th, and THREAD_STOPPED_FOREVER.
Referenced by rb_check_deadlock().
|
static |
Definition at line 3895 of file thread.c.
References clear_coverage_i(), rb_get_coverages(), rb_hash_tbl_raw(), RTEST, and st_foreach().
Referenced by rb_thread_atfork_internal().
Definition at line 3881 of file thread.c.
References INT2FIX, Qnil, RARRAY_AREF, RARRAY_ASET, RARRAY_LEN, ST_CONTINUE, and val.
Referenced by clear_coverage().
|
static |
Definition at line 3426 of file thread.c.
References BLOCKING_REGION, errno, FALSE, GET_THREAD(), rb_fd_dup, rb_fd_init_copy, rb_fd_term, result, RUBY_VM_CHECK_INTS_BLOCKING, timeofday(), timeval::tv_sec, timeval::tv_usec, and UNINITIALIZED_VAR.
Referenced by rb_thread_fd_select().
|
static |
Definition at line 964 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 4930 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_key, 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 4912 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 1015 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 1676 of file thread.c.
References rb_eArgError, rb_raise(), ST_CONTINUE, sym_immediate, sym_never, sym_on_blocking, and val.
Referenced by rb_thread_s_handle_interrupt().
|
static |
Definition at line 4763 of file thread.c.
References hash(), rb_hash_new(), rb_hash_tbl_raw(), st_hashtype_num, and st_table::type.
Referenced by recursive_list_access().
|
static |
Definition at line 3725 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 5079 of file thread.c.
References closed_stream_error, GET_THREAD(), ID2SYM, id_locals, rb_thread_struct::interrupt_cond, rb_thread_struct::interrupt_lock, rb_thread_struct::interrupt_mask, mutex_alloc(), mutex_initialize(), mutex_sleep(), OBJ_FREEZE, OBJ_TAINT, 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_cMutex, 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_exc_new2, rb_intern, rb_mutex_lock(), rb_mutex_locked_p(), rb_mutex_owned_p(), rb_mutex_synchronize_m(), rb_mutex_trylock(), rb_mutex_unlock(), 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_group(), rb_thread_inspect(), 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_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_safe_level(), 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(), recursive_key, 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 3032 of file thread.c.
References key, rb_ary_push(), and ST_CONTINUE.
Referenced by rb_thread_variables().
|
static |
Definition at line 4313 of file thread.c.
References rb_mutex_struct::cond, rb_mutex_struct::cond_waiting, err, ETIMEDOUT, rb_mutex_struct::lock, RUBY_VM_INTERRUPTED, rb_mutex_struct::th, timespec::tv_nsec, and timespec::tv_sec.
Referenced by rb_mutex_lock().
|
static |
Definition at line 4353 of file thread.c.
References rb_mutex_struct::cond, rb_mutex_struct::cond_waiting, and rb_mutex_struct::lock.
Referenced by rb_mutex_lock().
Definition at line 4231 of file thread.c.
References rb_mutex_struct::cond, rb_mutex_struct::lock, mutex_data_type, and TypedData_Make_Struct.
Referenced by Init_Thread(), rb_mutex_new(), and thread_shield_alloc().
|
static |
Definition at line 4192 of file thread.c.
References rb_mutex_struct::cond, err, rb_mutex_struct::lock, rb_bug(), rb_mutex_unlock_th(), ruby_xfree(), and rb_mutex_struct::th.
Definition at line 4249 of file thread.c.
Referenced by Init_Thread().
|
static |
Definition at line 4275 of file thread.c.
References GetMutexPtr, rb_thread_struct::keeping_mutexes, and rb_mutex_struct::next_mutex.
Referenced by rb_mutex_lock(), and rb_mutex_trylock().
Definition at line 4606 of file thread.c.
References argc, argv, rb_mutex_sleep(), and rb_scan_args().
Referenced by Init_Thread().
NOINLINE | ( | static int | thread_start_func_2rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start | ) |
|
static |
Definition at line 5256 of file thread.c.
References argv, check_deadlock_i(), GET_THREAD(), rb_vm_struct::living_threads, rb_vm_struct::main_thread, st_table::num_entries, patrol_thread, rb_bug(), rb_eFatal, rb_str_new2, rb_threadptr_raise(), rb_vm_struct::sleeper, st_data_t, st_foreach(), and vm_living_thread_num().
Referenced by rb_mutex_lock(), sleep_forever(), and thread_start_func_2().
Definition at line 4992 of file thread.c.
References exec_recursive_params::arg, exec_recursive(), func, and exec_recursive_params::obj.
Referenced by ary_join_1(), enumerator_inspect(), 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 5015 of file thread.c.
References exec_recursive_params::arg, exec_recursive(), 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 5003 of file thread.c.
References exec_recursive_params::arg, exec_recursive(), func, exec_recursive_params::obj, and rb_obj_id().
Referenced by hash_equal(), range_eq(), range_eql(), rb_ary_cmp(), rb_ary_eql(), rb_ary_equal(), 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 5027 of file thread.c.
References exec_recursive_params::arg, exec_recursive(), func, exec_recursive_params::obj, and rb_obj_id().
Referenced by cmp_eq().
ID rb_frame_last_func | ( | void | ) |
Definition at line 982 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().
VALUE rb_get_coverages | ( | void | ) |
Definition at line 5297 of file thread.c.
References GET_VM.
Referenced by clear_coverage(), coverage(), prepare_iseq_build(), rb_coverage_result(), and rb_coverage_start().
|
static |
Definition at line 4543 of file thread.c.
References rb_mutex_struct::next_mutex, and rb_mutex_struct::th.
Referenced by rb_mutex_abandon_keeping_mutexes(), and rb_mutex_abandon_locking_mutex().
|
static |
Definition at line 4521 of file thread.c.
References rb_thread_struct::keeping_mutexes, NULL, and rb_mutex_abandon_all().
Referenced by terminate_atfork_i().
|
static |
Definition at line 4530 of file thread.c.
References GetMutexPtr, rb_thread_struct::locking_mutex, Qfalse, rb_mutex_abandon_all(), and rb_mutex_struct::th.
Referenced by terminate_atfork_i().
void rb_mutex_allow_trap | ( | VALUE | self, |
int | val | ||
) |
Definition at line 4646 of file thread.c.
References rb_mutex_struct::allow_trap, GetMutexPtr, and val.
Referenced by io_binwrite().
Definition at line 4377 of file thread.c.
References rb_mutex_struct::allow_trap, FALSE, GET_THREAD(), GetMutexPtr, GVL_UNLOCK_BEGIN, GVL_UNLOCK_END, rb_thread_struct::interrupt_mask, rb_mutex_struct::lock, lock_func(), lock_interrupt(), rb_thread_struct::locking_mutex, mutex_locked(), NULL, patrol_thread, Qfalse, rb_check_deadlock(), rb_eThreadError, rb_mutex_trylock(), rb_raise(), reset_unblock_function(), RUBY_VM_CHECK_INTS_BLOCKING, set_unblock_function(), rb_vm_struct::sleeper, rb_thread_struct::status, rb_mutex_struct::th, THREAD_STOPPED_FOREVER, TRAP_INTERRUPT_MASK, rb_thread_struct::vm, and vm_living_thread_num().
Referenced by Init_Thread(), rb_mutex_sleep(), rb_mutex_synchronize(), rb_thread_shield_new(), and rb_thread_shield_wait().
Definition at line 4267 of file thread.c.
References GetMutexPtr, Qfalse, Qtrue, and rb_mutex_struct::th.
Referenced by Init_Thread().
VALUE rb_mutex_new | ( | void | ) |
Definition at line 4255 of file thread.c.
References mutex_alloc(), and rb_cMutex.
Referenced by io_binwrite().
Definition at line 4453 of file thread.c.
References GET_THREAD(), GetMutexPtr, Qfalse, Qtrue, and rb_mutex_struct::th.
Referenced by finish_writeconv(), Init_Thread(), and io_flush_buffer().
Definition at line 4571 of file thread.c.
References INT2FIX, NIL_P, Qnil, rb_ensure(), rb_mutex_lock(), rb_mutex_sleep_forever(), rb_mutex_unlock(), rb_mutex_wait_for(), rb_time_interval(), and t().
Referenced by mutex_sleep().
Definition at line 4556 of file thread.c.
References GET_THREAD(), Qnil, and sleep_forever().
Referenced by rb_mutex_sleep().
Definition at line 4623 of file thread.c.
References func, rb_ensure(), rb_mutex_lock(), and rb_mutex_unlock().
Referenced by fptr_finalize(), io_binwrite(), io_flush_buffer(), and rb_mutex_synchronize_m().
Definition at line 4637 of file thread.c.
References Qundef, rb_block_given_p(), rb_eThreadError, rb_mutex_synchronize(), rb_raise(), and rb_yield().
Referenced by Init_Thread().
Definition at line 4294 of file thread.c.
References GET_THREAD(), GetMutexPtr, rb_mutex_struct::lock, mutex_locked(), Qfalse, Qtrue, and rb_mutex_struct::th.
Referenced by Init_Thread(), and rb_mutex_lock().
Definition at line 4508 of file thread.c.
References err, GET_THREAD(), GetMutexPtr, rb_eThreadError, rb_mutex_unlock_th(), and rb_raise().
Referenced by Init_Thread(), rb_mutex_sleep(), rb_mutex_synchronize(), rb_thread_shield_destroy(), rb_thread_shield_release(), and rb_thread_shield_wait().
|
static |
Definition at line 4468 of file thread.c.
References rb_mutex_struct::cond, rb_mutex_struct::cond_waiting, err, rb_thread_struct::keeping_mutexes, rb_mutex_struct::lock, rb_mutex_struct::next_mutex, NULL, and rb_mutex_struct::th.
Referenced by mutex_free(), rb_mutex_unlock(), and rb_threadptr_unlock_all_locking_mutexes().
Definition at line 4563 of file thread.c.
References GET_THREAD(), Qnil, sleep_timeval(), and t().
Referenced by rb_mutex_sleep().
void rb_nativethread_lock_destroy | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 286 of file thread.c.
Referenced by ossl_dyn_destroy_callback().
void rb_nativethread_lock_initialize | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 280 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 292 of file thread.c.
Referenced by ossl_lock_unlock().
void rb_nativethread_lock_unlock | ( | rb_nativethread_lock_t * | lock | ) |
Definition at line 298 of file thread.c.
Referenced by ossl_lock_unlock().
Definition at line 4220 of file thread.c.
References mutex_data_type, Qfalse, Qtrue, and rb_typeddata_is_kind_of().
Referenced by rb_objspace_call_finalizer().
void rb_reset_coverages | ( | void | ) |
Definition at line 5310 of file thread.c.
References GET_VM, Qfalse, rb_remove_event_hook(), and update_coverage().
Referenced by rb_coverage_result().
void rb_set_coverages | ( | VALUE | coverages | ) |
Definition at line 5303 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 2525 of file thread.c.
References rb_thread_struct::abort_on_exception, GetThreadPtr, Qfalse, and Qtrue.
Referenced by Init_Thread().
Definition at line 2549 of file thread.c.
References rb_thread_struct::abort_on_exception, GetThreadPtr, RTEST, and val.
Referenced by Init_Thread().
Definition at line 2672 of file thread.c.
References GetThreadPtr, Qfalse, Qtrue, and rb_threadptr_dead().
Referenced by Init_Thread().
int rb_thread_alone | ( | void | ) |
Definition at line 2994 of file thread.c.
References GET_THREAD(), thread_debug, and vm_living_thread_num().
Referenced by io_writable_length(), ip_rb_threadTkWaitCommand(), ip_rb_threadUpdateCommand(), ip_rb_threadVwaitCommand(), ip_rbTkWaitCommand(), ip_rbVwaitCommand(), lib_eventloop_core(), rb_thread_polling(), rb_thread_schedule_limits(), rb_thread_stop(), rb_thread_terminate_all(), rb_waitpid(), and thread_start_func_2().
Definition at line 2833 of file thread.c.
References key, Qnil, rb_check_id(), and rb_thread_local_aref().
Referenced by Init_Thread().
Definition at line 2884 of file thread.c.
References rb_thread_local_aset(), rb_to_id(), and val.
Referenced by Init_Thread().
void rb_thread_atfork | ( | void | ) |
Definition at line 3935 of file thread.c.
References GET_THREAD(), rb_thread_struct::join_list, NULL, rb_reset_random_seed(), rb_thread_atfork_internal(), and terminate_atfork_i().
Referenced by pipe_open().
void rb_thread_atfork_before_exec | ( | void | ) |
Definition at line 3958 of file thread.c.
References rb_thread_atfork_internal(), and terminate_atfork_before_exec_i().
Definition at line 3904 of file thread.c.
References clear_coverage(), GET_THREAD(), rb_vm_struct::living_threads, rb_vm_struct::main_thread, rb_thread_struct::self, rb_vm_struct::sleeper, st_clear(), st_data_t, st_foreach(), st_insert(), and rb_thread_struct::vm.
Referenced by rb_thread_atfork(), and rb_thread_atfork_before_exec().
Definition at line 5058 of file thread.c.
References argc, argv, and rb_vm_thread_backtrace_locations().
Referenced by Init_Thread().
Definition at line 5041 of file thread.c.
References argc, argv, and rb_vm_thread_backtrace().
Referenced by Init_Thread().
VALUE rb_thread_blocking_region | ( | rb_blocking_function_t * | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
Definition at line 1417 of file thread.c.
References f, func, and rb_thread_call_without_gvl().
Referenced by rb_waitpid().
struct rb_blocking_region_buffer* rb_thread_blocking_region_begin | ( | void | ) |
Definition at line 1236 of file thread.c.
References ALLOC, blocking_region_begin(), FALSE, and GET_THREAD().
void rb_thread_blocking_region_end | ( | struct rb_blocking_region_buffer * | region | ) |
Definition at line 1245 of file thread.c.
References blocking_region_end(), errno, RUBY_VM_CHECK_INTS_BLOCKING, and xfree().
void* rb_thread_call_with_gvl | ( | void *(*)(void *) | func, |
void * | data1 | ||
) |
Definition at line 1454 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(), and rb_thread_struct::unblock.
Referenced by 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 1377 of file thread.c.
References call_without_gvl(), FALSE, and func.
Referenced by rb_thread_blocking_region().
void* rb_thread_call_without_gvl2 | ( | void *(*)(void *) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
Definition at line 1370 of file thread.c.
References call_without_gvl(), func, and TRUE.
Referenced by io_flush_buffer_async2(), and rb_write_internal2().
void rb_thread_check_ints | ( | void | ) |
Definition at line 1143 of file thread.c.
References GET_THREAD(), and RUBY_VM_CHECK_INTS_BLOCKING.
Referenced by bary_short_mul(), BigMath_s_exp(), collect_all(), enum_to_h_i(), io_binwrite(), lib_eventloop_core(), rb_io_wait_readable(), rb_io_wait_writable(), and trap_check().
int rb_thread_check_trap_pending | ( | void | ) |
Definition at line 1153 of file thread.c.
References rb_signal_buff_size().
Definition at line 745 of file thread.c.
References rb_cThread, rb_thread_alloc(), and thread_create_core().
Referenced by lib_thread_callback(), lib_watchdog_core(), and rb_detach_process().
VALUE rb_thread_current | ( | void | ) |
Definition at line 2405 of file thread.c.
References GET_THREAD(), and rb_thread_struct::self.
Referenced by call_queue_handler(), chdir_yield(), copy_stream_body(), delete_current_thread(), dir_s_chdir(), eval_queue_handler(), exec_recursive(), invoke_queue_handler(), ip_eval(), ip_invoke_real(), ip_invoke_with_position(), ip_rb_threadTkWaitCommand(), ip_rb_threadUpdateCommand(), ip_rb_threadVwaitCommand(), ip_rbTkWaitCommand(), ip_rbVwaitCommand(), lib_eventloop_ensure(), lib_eventloop_launcher(), lib_evloop_thread_p(), lib_watchdog_core(), queue_do_pop(), rb_autoload_load(), rb_autoloading_value(), rb_condvar_wait(), rb_const_set(), rb_dl_get_last_error(), rb_dl_set_last_error(), rb_f_kill(), rb_szqueue_push(), recursive_list_access(), thread_s_current(), tk_funcall(), VpGetException(), VpGetPrecLimit(), and VpGetRoundMode().
void rb_thread_execute_interrupts | ( | VALUE | thval | ) |
Definition at line 2030 of file thread.c.
References GetThreadPtr, and rb_threadptr_execute_interrupts().
Referenced by exec_interrupts(), maygvl_copy_stream_continue_p(), and rb_f_kill().
|
static |
Definition at line 2252 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 2135 of file thread.c.
References GET_THREAD(), st_foreach(), and thread_fd_close_i().
Referenced by io_reopen(), and rb_io_close().
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 3580 of file thread.c.
References do_select(), max(), rb_fd_resize, rb_thread_sleep_forever(), and rb_thread_wait_for().
Referenced by maygvl_select(), rb_thread_select(), select_internal(), and select_single().
int rb_thread_fd_writable | ( | int | fd | ) |
Definition at line 3529 of file thread.c.
References rb_thread_wait_fd_rw(), and TRUE.
Referenced by rb_io_wait_writable(), rsock_bsock_send(), and udp_send().
Definition at line 2570 of file thread.c.
References GetThreadPtr, Qnil, and rb_thread_struct::thgroup.
Referenced by Init_Thread().
Definition at line 2738 of file thread.c.
References GetThreadPtr, OBJ_INFECT, rb_obj_classname(), rb_sprintf(), and thread_status_name().
Referenced by Init_Thread().
int rb_thread_interrupted | ( | VALUE | thval | ) |
Definition at line 1160 of file thread.c.
References GetThreadPtr, and RUBY_VM_INTERRUPTED.
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 1384 of file thread.c.
References BLOCKING_REGION, errno, EXEC_TAG, FALSE, func, GET_THREAD(), JUMP_TAG, Qundef, RUBY_VM_CHECK_INTS_BLOCKING, TH_POP_TAG, TH_PUSH_TAG, val, and rb_thread_struct::waiting_fd.
Referenced by do_ioctl(), io_flush_buffer_async(), rb_file_flock(), rb_io_flush_raw(), rb_read_internal(), and rb_write_internal().
Definition at line 2964 of file thread.c.
References GetThreadPtr, key, rb_thread_struct::local_storage, Qfalse, Qtrue, rb_check_id(), and st_lookup().
Referenced by Init_Thread().
Definition at line 3019 of file thread.c.
References GetThreadPtr, rb_thread_struct::local_storage, rb_ary_new(), st_foreach(), and thread_keys_i().
Referenced by Init_Thread().
Definition at line 2191 of file thread.c.
References eKillSignal, EXIT_SUCCESS, GET_THREAD(), GetThreadPtr, rb_vm_struct::main_thread, rb_exit(), rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), rb_threadptr_to_kill(), rb_thread_struct::status, thread_debug, rb_thread_struct::thread_id, THREAD_KILLED, 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 2397 of file thread.c.
References GET_THREAD(), rb_ary_new(), st_foreach(), and thread_list_i().
Referenced by Init_Thread().
Definition at line 2765 of file thread.c.
References GetThreadPtr, and threadptr_local_aref().
Referenced by detach_process_pid(), rb_dl_get_last_error(), rb_thread_aref(), recursive_list_access(), VpGetException(), VpGetPrecLimit(), and VpGetRoundMode().
Definition at line 2858 of file thread.c.
References GetThreadPtr, OBJ_FROZEN, rb_error_frozen(), threadptr_local_aset(), and val.
Referenced by rb_detach_process(), rb_dl_set_last_error(), rb_thread_aset(), and recursive_list_access().
VALUE rb_thread_main | ( | void | ) |
Definition at line 2426 of file thread.c.
References GET_THREAD(), rb_vm_struct::main_thread, rb_thread_struct::self, and rb_thread_struct::vm.
Referenced by rb_thread_s_main().
Definition at line 1843 of file thread.c.
References argc, argv, err, GetThreadPtr, 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().
void rb_thread_polling | ( | void | ) |
Definition at line 1126 of file thread.c.
References GET_THREAD(), rb_thread_alone(), RUBY_VM_CHECK_INTS_BLOCKING, and sleep_for_polling().
Definition at line 3120 of file thread.c.
References GetThreadPtr, INT2NUM, and rb_thread_struct::priority.
Referenced by Init_Thread().
Definition at line 3155 of file thread.c.
References GetThreadPtr, INT2NUM, NUM2INT, rb_thread_struct::priority, RUBY_THREAD_PRIORITY_MAX, and RUBY_THREAD_PRIORITY_MIN.
Referenced by Init_Thread().
void rb_thread_reset_timer_thread | ( | void | ) |
Definition at line 3868 of file thread.c.
Referenced by after_exec_non_async_signal_safe().
Definition at line 2322 of file thread.c.
References rb_thread_schedule(), and rb_thread_wakeup().
Referenced by call_queue_handler(), eval_queue_handler(), Init_Thread(), invoke_queue_handler(), lib_eventloop_launcher(), and lib_watchdog_core().
|
static |
Definition at line 2466 of file thread.c.
References GET_THREAD(), Qfalse, Qtrue, rb_vm_struct::thread_abort_on_exception, and rb_thread_struct::vm.
Referenced by Init_Thread().
Definition at line 2502 of file thread.c.
References GET_THREAD(), RTEST, rb_vm_struct::thread_abort_on_exception, val, and rb_thread_struct::vm.
Referenced by Init_Thread().
Definition at line 1792 of file thread.c.
References EXEC_TAG, GET_THREAD(), handle_interrupt_arg_check_i(), JUMP_TAG, 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, TH_POP_TAG, and TH_PUSH_TAG.
Referenced by Init_Thread().
Definition at line 1928 of file thread.c.
References argc, argv, GET_THREAD(), and rb_thread_pending_interrupt_p().
Referenced by Init_Thread().
Definition at line 2722 of file thread.c.
References GetThreadPtr, INT2NUM, and rb_thread_struct::safe_level.
Referenced by Init_Thread().
void rb_thread_schedule | ( | void | ) |
Definition at line 1191 of file thread.c.
References GET_THREAD(), rb_thread_schedule_limits(), rb_threadptr_execute_interrupts(), RUBY_VM_INTERRUPTED_ANY, and UNLIKELY.
Referenced by call_queue_handler(), eval_queue_handler(), invoke_queue_handler(), lib_eventloop_core(), lib_thread_callback(), proc_waitall(), rb_thread_run(), rb_waitpid(), rbtk_EventCheckProc(), and thread_s_pass().
|
static |
Definition at line 1174 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, thread_debug, and rb_thread_struct::vm.
Referenced by rb_thread_schedule(), and rb_threadptr_execute_interrupts().
int rb_thread_select | ( | int | max, |
fd_set * | read, | ||
fd_set * | write, | ||
fd_set * | except, | ||
struct timeval * | timeout | ||
) |
Definition at line 3536 of file thread.c.
References max(), NULL, rb_fd_copy, rb_fd_init, rb_fd_rcopy, rb_fd_term, and rb_thread_fd_select().
Definition at line 4749 of file thread.c.
References DATA_PTR, GetThreadShieldPtr, Qfalse, Qtrue, rb_mutex_unlock(), and rb_thread_shield_waiting.
Referenced by release_thread_shield().
VALUE rb_thread_shield_new | ( | void | ) |
Definition at line 4702 of file thread.c.
References DATA_PTR, rb_cThreadShield, rb_mutex_lock(), and thread_shield_alloc().
Referenced by load_lock().
Definition at line 4738 of file thread.c.
References GetThreadShieldPtr, Qfalse, Qtrue, rb_mutex_unlock(), and rb_thread_shield_waiting.
Referenced by release_thread_shield().
Definition at line 4718 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 4692 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 4681 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 1168 of file thread.c.
References INT2FIX, rb_thread_wait_for(), and rb_time_timeval().
Referenced by pipe_open().
void rb_thread_sleep_deadly | ( | void | ) |
Definition at line 1080 of file thread.c.
References GET_THREAD(), sleep_forever(), and thread_debug.
Referenced by queue_sleep(), rb_szqueue_push(), and rb_thread_stop().
void rb_thread_sleep_forever | ( | void | ) |
Definition at line 1073 of file thread.c.
References GET_THREAD(), sleep_forever(), and thread_debug.
Referenced by lib_eventloop_core(), rb_f_sleep(), and rb_thread_fd_select().
void rb_thread_start_timer_thread | ( | void | ) |
Definition at line 3874 of file thread.c.
References system_working.
Referenced by after_exec_non_async_signal_safe().
|
static |
Definition at line 2641 of file thread.c.
References rb_thread_struct::errinfo, FIXNUM_P, GetThreadPtr, NIL_P, Qfalse, Qnil, rb_str_new2, rb_threadptr_dead(), and thread_status_name().
VALUE rb_thread_stop | ( | void | ) |
Definition at line 2346 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 2697 of file thread.c.
References GetThreadPtr, Qfalse, Qtrue, rb_threadptr_dead(), rb_thread_struct::status, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by Init_Thread().
void rb_thread_stop_timer_thread | ( | int | close_anyway | ) |
Definition at line 3860 of file thread.c.
Referenced by before_exec_non_async_signal_safe(), and ruby_cleanup().
void rb_thread_terminate_all | ( | void | ) |
Definition at line 421 of file thread.c.
References GET_THREAD(), rb_vm_struct::living_threads, rb_vm_struct::main_thread, rb_bug(), rb_thread_alone(), rb_threadptr_unlock_all_locking_mutexes(), RUBY_VM_CHECK_INTS_BLOCKING, st_data_t, st_foreach(), terminate_i(), rb_mutex_struct::th, TH_EXEC_TAG, TH_POP_TAG, TH_PUSH_TAG, thread_debug, and rb_thread_struct::vm.
Referenced by ruby_cleanup().
Definition at line 2918 of file thread.c.
References ID2SYM, id_locals, key, Qnil, rb_check_id(), rb_hash_aref(), and rb_ivar_get().
Referenced by Init_Thread().
Definition at line 3085 of file thread.c.
References ID2SYM, id_locals, key, Qfalse, Qtrue, rb_check_id(), rb_ivar_get(), RHASH, and st_lookup().
Referenced by Init_Thread().
Definition at line 2938 of file thread.c.
References ID2SYM, id_locals, OBJ_FROZEN, rb_error_frozen(), rb_hash_aset(), rb_ivar_get(), rb_to_id(), and val.
Referenced by Init_Thread().
Definition at line 3056 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 3523 of file thread.c.
References rb_thread_wait_fd_rw().
Referenced by ossl_ssl_read_internal(), rb_io_read_check(), rb_io_sysread(), rb_io_wait_readable(), rb_read_check(), rsock_s_accept(), and rsock_s_recvfrom().
|
static |
Definition at line 3503 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 1119 of file thread.c.
References GET_THREAD(), and sleep_timeval().
Referenced by ip_eval(), ip_invoke_with_position(), ip_rb_threadTkWaitCommand(), ip_rb_threadUpdateCommand(), ip_rb_threadVwaitCommand(), lib_watchdog_core(), rb_f_sleep(), rb_file_flock(), rb_thread_fd_select(), rb_thread_sleep(), rsock_connect(), and tk_funcall().
Definition at line 2276 of file thread.c.
References rb_eThreadError, rb_raise(), rb_thread_wakeup_alive(), and RTEST.
Referenced by call_queue_handler(), eval_queue_handler(), Init_Thread(), invoke_queue_handler(), lib_eventloop_ensure(), rb_thread_run(), rb_threadUpdateProc(), rb_threadVwaitProc(), rb_threadWaitVisibilityProc(), and rb_threadWaitWindowProc().
Definition at line 2285 of file thread.c.
References GetThreadPtr, Qnil, rb_threadptr_ready(), rb_thread_struct::status, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by 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 3819 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 2603 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 1957 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(), and rb_thread_schedule().
void rb_threadptr_interrupt | ( | rb_thread_t * | th | ) |
Definition at line 359 of file thread.c.
References rb_threadptr_interrupt_common().
Referenced by rb_thread_kill(), rb_threadptr_raise(), rb_threadptr_ready(), ruby_cleanup(), terminate_i(), thread_fd_close_i(), and thread_start_func_2().
|
static |
Definition at line 341 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, trap(), 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 1657 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 1562 of file thread.c.
References err, 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 1542 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 1620 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 1601 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(), and rb_threadptr_pending_interrupt_deque().
void rb_threadptr_pending_interrupt_enque | ( | rb_thread_t * | th, |
VALUE | v | ||
) |
Definition at line 1548 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_thread_kill(), rb_threadptr_raise(), terminate_i(), and thread_fd_close_i().
|
static |
Definition at line 1607 of file thread.c.
References err, 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 2044 of file thread.c.
References argc, argv, Qnil, rb_eRuntimeError, rb_exc_new(), rb_make_exception(), rb_threadptr_dead(), rb_threadptr_interrupt(), and rb_threadptr_pending_interrupt_enque().
Referenced by rb_check_deadlock(), rb_threadptr_signal_exit(), rb_threadptr_signal_raise(), thread_raise_m(), and thread_start_func_2().
|
static |
Definition at line 2038 of file thread.c.
References rb_threadptr_interrupt().
Referenced by rb_thread_wakeup_alive().
int rb_threadptr_reset_raised | ( | rb_thread_t * | th | ) |
Definition at line 2110 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().
VALUE rb_threadptr_reset_recursive_data | ( | rb_thread_t * | th | ) |
Definition at line 4799 of file thread.c.
References Qnil, recursive_key, threadptr_local_aref(), and threadptr_local_aset().
Referenced by rb_threadptr_exec_event_hooks_orig().
void rb_threadptr_restore_recursive_data | ( | rb_thread_t * | th, |
VALUE | old | ||
) |
Definition at line 4807 of file thread.c.
References recursive_key, and threadptr_local_aset().
Referenced by rb_threadptr_exec_event_hooks_orig().
int rb_threadptr_set_raised | ( | rb_thread_t * | th | ) |
Definition at line 2100 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_signal_exit | ( | rb_thread_t * | th | ) |
Definition at line 2074 of file thread.c.
References argv, rb_vm_struct::main_thread, rb_eSystemExit, rb_str_new2, rb_threadptr_raise(), and rb_thread_struct::vm.
Referenced by rb_signal_exec().
void rb_threadptr_signal_raise | ( | rb_thread_t * | th, |
int | sig | ||
) |
Definition at line 2064 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 1934 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 365 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 404 of file thread.c.
References err, rb_thread_struct::keeping_mutexes, rb_mutex_struct::next_mutex, rb_bug(), rb_mutex_unlock_th(), and rb_mutex_struct::th.
Referenced by rb_thread_terminate_all(), ruby_cleanup(), and thread_start_func_2().
Definition at line 5317 of file thread.c.
References GET_THREAD(), rb_thread_struct::pending_interrupt_mask_stack, rb_ary_pop(), rb_ary_push(), rb_cObject, rb_ensure(), rb_hash_aset(), rb_hash_new(), and sym_never.
Referenced by rb_f_p().
void rb_vm_gvl_destroy | ( | rb_vm_t * | vm | ) |
Definition at line 272 of file thread.c.
References rb_vm_struct::thread_destruct_lock.
Referenced by ruby_vm_destruct().
int rb_wait_for_single_fd | ( | int | fd, |
int | events, | ||
struct timeval * | tv | ||
) |
Definition at line 3779 of file thread.c.
References select_args::as, errno, select_args::error, select_args::except, 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 io_wait_readable(), io_wait_writable(), rb_thread_wait_fd_rw(), and wait_connectable().
Definition at line 4819 of file thread.c.
References list, 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 4779 of file thread.c.
References hash(), ident_hash_new(), list, NIL_P, Qnil, rb_hash_aref(), rb_hash_aset(), rb_thread_current(), rb_thread_local_aref(), rb_thread_local_aset(), RB_TYPE_P, recursive_key, sym, and T_HASH.
Referenced by exec_recursive().
Definition at line 4884 of file thread.c.
References list, Qundef, rb_hash_delete(), rb_hash_lookup2(), RB_TYPE_P, RHASH_EMPTY_P, and T_HASH.
Referenced by exec_recursive().
Definition at line 4854 of file thread.c.
References list, Qtrue, Qundef, rb_hash_aset(), rb_hash_lookup2(), rb_hash_new(), RB_TYPE_P, and T_HASH.
Referenced by exec_recursive().
Definition at line 761 of file thread.c.
References rb_thread_struct::join_list, rb_thread_list_struct::next, Qnil, rb_thread_struct::status, join_arg::target, THREAD_KILLED, and join_arg::waiting.
Referenced by thread_join().
|
static |
Definition at line 333 of file thread.c.
References rb_thread_struct::interrupt_lock, and rb_thread_struct::unblock.
Referenced by blocking_region_end(), and rb_mutex_lock().
void ruby_kill | ( | rb_pid_t | pid, |
int | sig | ||
) |
Definition at line 5329 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_thread_has_gvl_p | ( | void | ) |
Definition at line 1496 of file thread.c.
References rb_thread_struct::blocking_region_buffer.
Referenced by 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 497 of file thread.c.
References rb_mutex_struct::th.
Referenced by Init_BareVM().
void ruby_thread_stack_overflow | ( | rb_thread_t * | th | ) |
Definition at line 2088 of file thread.c.
References rb_thread_struct::errinfo, rb_thread_struct::raised_flag, rb_exc_raise(), sysstack_error, TAG_RAISE, and TH_JUMP_TAG.
Definition at line 3745 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 3767 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 304 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 1110 of file thread.c.
References sleep_timeval(), timeval::tv_sec, and timeval::tv_usec.
Referenced by rb_thread_polling().
|
static |
Definition at line 991 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_mutex_sleep_forever(), rb_thread_sleep_deadly(), rb_thread_sleep_forever(), and thread_join_sleep().
|
static |
Definition at line 1031 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(), sleep_for_polling(), and sleep_wait_for_interrupt().
|
static |
Definition at line 1104 of file thread.c.
References double2timeval(), and sleep_timeval().
Referenced by thread_join_sleep().
Definition at line 100 of file thread.c.
References key, and st_delete().
Referenced by thread_start_func_2(), and threadptr_local_aset().
|
static |
Definition at line 3945 of file thread.c.
References GetThreadPtr, key, ST_CONTINUE, and thread_cleanup_func_before_exec().
Referenced by rb_thread_atfork_before_exec().
Definition at line 3920 of file thread.c.
References GetThreadPtr, key, rb_mutex_abandon_keeping_mutexes(), rb_mutex_abandon_locking_mutex(), ST_CONTINUE, thread_cleanup_func(), and TRUE.
Referenced by rb_thread_atfork().
|
static |
Definition at line 371 of file thread.c.
References eTerminateSignal, GetThreadPtr, key, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), ST_CONTINUE, and thread_debug.
Referenced by rb_thread_terminate_all().
Definition at line 4128 of file thread.c.
References thgroup::enclosed, GetThreadPtr, thgroup::group, OBJ_FROZEN, Qnil, rb_eThreadError, rb_raise(), rb_thread_struct::thgroup, thgroup_data_type, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 4071 of file thread.c.
References thgroup::enclosed, thgroup::group, thgroup_data_type, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 4090 of file thread.c.
References thgroup::enclosed, thgroup::group, Qfalse, Qtrue, thgroup_data_type, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 4042 of file thread.c.
References thgroup_list_params::ary, GET_THREAD(), thgroup_list_params::group, rb_ary_new(), st_data_t, st_foreach(), and thgroup_list_i().
Referenced by Init_Thread().
Definition at line 4018 of file thread.c.
References thgroup_list_params::ary, GetThreadPtr, thgroup_list_params::group, key, rb_ary_push(), ST_CONTINUE, and rb_thread_struct::thgroup.
Referenced by thgroup_list().
Definition at line 4000 of file thread.c.
References thgroup::enclosed, thgroup::group, thgroup_data_type, and TypedData_Make_Struct.
Referenced by Init_Thread().
|
static |
Definition at line 475 of file thread.c.
References rb_thread_struct::interrupt_lock, rb_thread_struct::locking_mutex, Qfalse, rb_mutex_struct::th, and thread_cleanup_func_before_exec().
Referenced by terminate_atfork_i(), and thread_start_func_2().
|
static |
Definition at line 464 of file thread.c.
References rb_thread_struct::machine, rb_thread_struct::stack_end, rb_thread_struct::stack_start, rb_thread_struct::status, rb_mutex_struct::th, and THREAD_KILLED.
Referenced by terminate_atfork_before_exec_i(), and thread_cleanup_func().
Definition at line 625 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, rb_vm_struct::living_threads, 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(), RBASIC_CLEAR_CLASS, st_data_t, st_insert(), rb_thread_struct::status, strerror(), rb_mutex_struct::th, rb_thread_struct::thgroup, rb_thread_struct::thread_id, THREAD_KILLED, and rb_thread_struct::vm.
Referenced by rb_thread_create(), thread_initialize(), and thread_start().
Definition at line 2120 of file thread.c.
References err, GetThreadPtr, key, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), ruby_error_closed_stream, rb_vm_struct::special_exceptions, ST_CONTINUE, rb_thread_struct::vm, and rb_thread_struct::waiting_fd.
Referenced by rb_thread_fd_close().
Definition at line 720 of file thread.c.
References rb_thread_struct::first_args, rb_thread_struct::first_proc, GetThreadPtr, NIL_P, NUM2INT, RARRAY_AREF, rb_block_given_p(), rb_eThreadError, rb_proc_location(), rb_raise(), RSTRING_PTR, RTEST, rb_mutex_struct::th, and thread_create_core().
Referenced by Init_Thread().
|
static |
Definition at line 808 of file thread.c.
References DELAY_INFTY, err, rb_thread_struct::errinfo, FIXNUM_P, join_arg::forever, GET_THREAD(), GET_THROWOBJ_STATE, GET_THROWOBJ_VAL, GET_VM, rb_thread_struct::join_list, join_arg::limit, list, Qnil, rb_ensure(), rb_eThreadError, rb_exc_raise(), rb_raise(), RB_TYPE_P, rb_vm_make_jump_tag_but_local_jump(), remove_from_join_list(), rb_thread_struct::self, rb_thread_struct::status, T_NODE, join_arg::target, thread_debug, rb_thread_struct::thread_id, thread_join_sleep(), THREAD_KILLED, timeofday(), and join_arg::waiting.
Referenced by thread_join_m(), and thread_value().
Definition at line 899 of file thread.c.
References argc, argv, DELAY_INFTY, GetThreadPtr, join_arg::limit, NIL_P, rb_num2dbl(), rb_scan_args(), and thread_join().
Referenced by Init_Thread().
Definition at line 782 of file thread.c.
References join_arg::forever, join_arg::limit, Qfalse, Qtrue, sleep_forever(), sleep_wait_for_interrupt(), rb_thread_struct::status, join_arg::target, thread_debug, rb_thread_struct::thread_id, THREAD_KILLED, timeofday(), and join_arg::waiting.
Referenced by thread_join().
Definition at line 2981 of file thread.c.
References ID2SYM, key, rb_ary_push(), and ST_CONTINUE.
Referenced by rb_thread_keys().
Definition at line 2357 of file thread.c.
References GetThreadPtr, key, rb_ary_push(), rb_thread_struct::self, ST_CONTINUE, rb_thread_struct::status, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by rb_thread_list().
Definition at line 2162 of file thread.c.
References argc, argv, GET_THREAD(), GetThreadPtr, Qnil, rb_threadptr_raise(), and RUBY_VM_CHECK_INTS.
Referenced by Init_Thread().
Definition at line 2420 of file thread.c.
References rb_thread_current().
Referenced by Init_Thread().
Definition at line 685 of file thread.c.
References argc, argv, rb_thread_struct::first_args, GET_VM, GetThreadPtr, rb_class2name(), rb_eThreadError, rb_obj_call_init(), rb_raise(), rb_thread_alloc(), rb_mutex_struct::th, and THREAD_KILLED.
Referenced by Init_Thread().
Definition at line 1517 of file thread.c.
References Qnil, and rb_thread_schedule().
Referenced by Init_Thread().
Definition at line 4670 of file thread.c.
References mutex_alloc(), thread_shield_data_type, and TypedData_Wrap_Struct.
Referenced by rb_thread_shield_new().
|
static |
Definition at line 4658 of file thread.c.
References rb_gc_mark().
Definition at line 713 of file thread.c.
References rb_thread_alloc(), and thread_create_core().
Referenced by Init_Thread().
|
static |
Definition at line 503 of file thread.c.
References rb_thread_struct::abort_on_exception, rb_thread_struct::errinfo, EXEC_TAG, FALSE, rb_thread_struct::first_args, rb_thread_struct::first_func, rb_thread_struct::join_list, rb_vm_struct::living_threads, rb_thread_struct::locking_mutex, 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_thread_alone(), rb_thread_recycle_stack_release(), rb_thread_set_current, rb_threadptr_interrupt(), rb_threadptr_raise(), rb_threadptr_unlock_all_locking_mutexes(), RB_TYPE_P, rb_thread_struct::root_fiber, RTEST, ruby_debug, ruby_stop(), rb_vm_struct::running_thread, SAVE_ROOT_JMPBUF, rb_thread_struct::self, st_delete_wrap(), rb_thread_struct::stack, rb_thread_struct::stack_start, rb_thread_struct::status, T_OBJECT, TAG_FATAL, rb_mutex_struct::th, rb_thread_list_struct::th, TH_POP_TAG, TH_PUSH_TAG, rb_vm_struct::thread_abort_on_exception, thread_cleanup_func(), thread_debug, rb_vm_struct::thread_destruct_lock, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, rb_thread_struct::value, and rb_thread_struct::vm.
|
static |
Definition at line 2584 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 930 of file thread.c.
References DELAY_INFTY, GetThreadPtr, thread_join(), and rb_thread_struct::value.
Referenced by Init_Thread().
|
inlinestatic |
Definition at line 1944 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 2754 of file thread.c.
References rb_thread_struct::local_storage, Qnil, st_data_t, st_lookup(), and val.
Referenced by rb_thread_local_aref(), and rb_threadptr_reset_recursive_data().
|
static |
Definition at line 2841 of file thread.c.
References rb_thread_struct::local_storage, NIL_P, Qnil, st_delete_wrap(), st_init_numtable(), st_insert(), and val.
Referenced by rb_thread_local_aset(), rb_threadptr_reset_recursive_data(), and rb_threadptr_restore_recursive_data().
|
static |
Definition at line 1087 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(), thread_join(), and thread_join_sleep().
|
static |
Definition at line 3829 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 5280 of file thread.c.
References rb_thread_struct::cfp, count, rb_iseq_struct::coverage, coverage(), FIX2LONG, GET_THREAD(), rb_control_frame_struct::iseq, LONG2FIX, POSFIXABLE, Qnil, RARRAY_AREF, RARRAY_ASET, rb_sourceline(), and RBASIC.
Referenced by rb_reset_coverages(), and rb_set_coverages().
|
static |
Definition at line 2988 of file thread.c.
References rb_vm_struct::living_threads, and st_table::num_entries.
Referenced by rb_check_deadlock(), rb_mutex_lock(), and rb_thread_alone().
|
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 4213 of file thread.c.
Referenced by mutex_alloc(), and rb_obj_is_mutex().
|
static |
Definition at line 4367 of file thread.c.
Referenced by rb_check_deadlock(), and rb_mutex_lock().
VALUE rb_cMutex |
Definition at line 77 of file thread.c.
Referenced by Init_Thread(), and rb_mutex_new().
VALUE rb_cThreadShield |
Definition at line 78 of file thread.c.
Referenced by rb_thread_shield_new().
|
static |
Definition at line 4758 of file thread.c.
Referenced by exec_recursive(), Init_Thread(), rb_threadptr_reset_recursive_data(), rb_threadptr_restore_recursive_data(), and recursive_list_access().
const struct st_hash_type st_hashtype_num |
Referenced by ident_hash_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 95 of file thread.c.
Referenced by rb_thread_start_timer_thread().
|
static |
Definition at line 3974 of file thread.c.
Referenced by thgroup_add(), thgroup_enclose(), thgroup_enclosed_p(), and thgroup_s_alloc().
|
static |
Definition at line 4663 of file thread.c.
Referenced by thread_shield_alloc().