Ruby
2.0.0p645(2015-04-13revision50299)
|
#include "eval_intern.h"
#include "gc.h"
#include "internal.h"
#include "ruby/io.h"
#include "ruby/thread.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 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 |
#define BLOCKING_REGION | ( | exec, | |
ubf, | |||
ubfarg, | |||
fail_if_interrupted | |||
) |
Definition at line 152 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 98 of file thread.c.
Referenced by Init_Thread().
#define DELAY_INFTY 1E30 |
Definition at line 734 of file thread.c.
Referenced by thread_join(), thread_join_m(), and thread_value().
#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_i().
#define GetMutexPtr | ( | obj, | |
tobj | |||
) | TypedData_Get_Struct((obj), rb_mutex_t, &mutex_data_type, (tobj)) |
Definition at line 4105 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 4589 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 137 of file thread.c.
Referenced by rb_mutex_lock().
#define GVL_UNLOCK_END | ( | ) |
Definition at line 142 of file thread.c.
Referenced by rb_mutex_lock().
#define OBJ_ID_EQL | ( | obj_id, | |
other | |||
) | ((obj_id) == (other)) |
Referenced by recursive_check().
Definition at line 3338 of file thread.c.
Referenced by rb_thread_select().
#define RB_GC_SAVE_MACHINE_CONTEXT | ( | th | ) |
Definition at line 129 of file thread.c.
Referenced by blocking_region_begin(), and rb_thread_schedule_limits().
#define rb_intern | ( | str | ) | rb_intern_const(str) |
#define rb_thread_shield_waiting | ( | b | ) | (int)((RBASIC(b)->flags&THREAD_SHIELD_WAITING_MASK)>>THREAD_SHIELD_WAITING_SHIFT) |
Definition at line 4592 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 68 of file thread.c.
Referenced by rb_thread_priority_set().
#define RUBY_THREAD_PRIORITY_MIN -3 |
Definition at line 69 of file thread.c.
Referenced by rb_thread_priority_set().
#define thread_debug if(0)printf |
Definition at line 211 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 4590 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 4591 of file thread.c.
Referenced by rb_thread_shield_waiting_dec(), and rb_thread_shield_waiting_inc().
#define TIMET_MAX (~(time_t)0 <= 0 ? (time_t)((~(unsigned_time_t)0) >> 1) : (time_t)(~(unsigned_time_t)0)) |
Definition at line 76 of file thread.c.
Referenced by double2timeval(), and sleep_timeval().
#define TIMET_MIN (~(time_t)0 <= 0 ? (time_t)(((unsigned_time_t)1) << (sizeof(time_t) * CHAR_BIT - 1)) : (time_t)0) |
typedef struct rb_mutex_struct rb_mutex_t |
|
inlinestatic |
Definition at line 1159 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, TRUE, and rb_thread_struct::vm.
Referenced by rb_thread_blocking_region_begin(), and rb_thread_call_with_gvl().
|
inlinestatic |
Definition at line 1177 of file thread.c.
References rb_thread_struct::blocking_region_buffer, rb_blocking_region_buffer::oldubf, rb_blocking_region_buffer::prev_status, rb_thread_set_current, reset_unblock_function(), rb_thread_struct::status, 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 1211 of file thread.c.
References BLOCKING_REGION, errno, func, GET_THREAD(), RUBY_UBF_IO, RUBY_UBF_PROCESS, RUBY_VM_CHECK_INTS_BLOCKING, th, val, and rb_thread_struct::waiting_fd.
Referenced by rb_thread_call_without_gvl(), and rb_thread_call_without_gvl2().
Definition at line 5102 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, th, and THREAD_STOPPED_FOREVER.
Referenced by rb_check_deadlock().
Definition at line 3811 of file thread.c.
References clear_coverage_i(), rb_get_coverages(), RHASH_TBL, RTEST, and st_foreach().
Referenced by rb_thread_atfork_internal().
Definition at line 3797 of file thread.c.
References i, INT2FIX, Qnil, RARRAY_LEN, RARRAY_PTR(), and ST_CONTINUE.
Referenced by clear_coverage().
|
static |
Definition at line 3342 of file thread.c.
References BLOCKING_REGION, d, errno, FALSE, GET_THREAD(), int, rb_fd_dup, rb_fd_init_copy, rb_fd_term, result, retry, RUBY_VM_CHECK_INTS_BLOCKING, th, timeofday(), timeval::tv_sec, timeval::tv_usec, and UNINITIALIZED_VAR.
Referenced by rb_thread_fd_select().
|
static |
Definition at line 926 of file thread.c.
References d, int, isinf(), time, TIMET_MAX, timeval::tv_sec, and timeval::tv_usec.
Referenced by sleep_wait_for_interrupt().
|
static |
Definition at line 4832 of file thread.c.
References arg, exec_recursive_params::arg, exec_recursive_i(), func, exec_recursive_params::func, ID2SYM, idNULL, exec_recursive_params::list, obj, exec_recursive_params::obj, exec_recursive_params::objid, exec_recursive_params::pairid, PRIsVALUE, Qundef, rb_catch_obj(), 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 4803 of file thread.c.
References exec_recursive_params::arg, EXEC_TAG, FALSE, exec_recursive_params::func, JUMP_TAG, exec_recursive_params::list, exec_recursive_params::obj, exec_recursive_params::objid, exec_recursive_params::pairid, POP_TAG, PUSH_TAG, Qundef, recursive_pop(), recursive_push(), result, and state.
Referenced by exec_recursive().
Definition at line 970 of file thread.c.
References gettimeofday(), NULL, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
Referenced by sleep_timeval().
Definition at line 1631 of file thread.c.
References rb_eArgError, rb_raise(), ST_CONTINUE, sym_immediate, sym_never, and sym_on_blocking.
Referenced by rb_thread_s_handle_interrupt().
|
static |
Definition at line 3641 of file thread.c.
References rb_fd_init, and rb_fd_set.
Referenced by rb_wait_for_single_fd().
Definition at line 4976 of file thread.c.
References closed_stream_error, GET_THREAD(), ID2SYM, 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(), 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(), rb_thread_struct::vm, and void.
Definition at line 2950 of file thread.c.
References rb_ary_push(), and ST_CONTINUE.
Referenced by rb_thread_variables().
|
static |
Definition at line 4231 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, th, timespec::tv_nsec, and timespec::tv_sec.
Referenced by rb_mutex_lock().
Definition at line 4271 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 4149 of file thread.c.
References rb_mutex_struct::cond, rb_mutex_struct::lock, obj, and TypedData_Make_Struct.
Referenced by Init_Thread(), rb_mutex_new(), and thread_shield_alloc().
Definition at line 4111 of file thread.c.
References rb_mutex_struct::cond, err, rb_mutex_struct::lock, ptr, rb_bug(), rb_mutex_unlock_th(), ruby_xfree(), and rb_mutex_struct::th.
Definition at line 4167 of file thread.c.
Referenced by Init_Thread().
|
static |
Definition at line 4193 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 4521 of file thread.c.
References 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 | ) |
Definition at line 5150 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, rb_bug(), rb_eFatal, rb_str_new2, rb_threadptr_raise(), rb_vm_struct::sleeper, st_foreach(), and vm_living_thread_num().
Referenced by rb_mutex_lock(), sleep_forever(), and thread_start_func_2().
Definition at line 4881 of file thread.c.
References exec_recursive(), and func.
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 4904 of file thread.c.
References exec_recursive(), and func.
Referenced by range_hash(), rb_ary_hash(), rb_hash_hash(), and rb_struct_hash().
VALUE rb_exec_recursive_paired | ( | VALUE(*)(VALUE, VALUE, int) | func, |
VALUE | obj, | ||
VALUE | paired_obj, | ||
VALUE | arg | ||
) |
Definition at line 4892 of file thread.c.
References exec_recursive(), func, 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 4916 of file thread.c.
References exec_recursive(), func, and rb_obj_id().
Referenced by cmp_eq().
Definition at line 5191 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 4461 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 4439 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 4448 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().
Definition at line 4561 of file thread.c.
References rb_mutex_struct::allow_trap, GetMutexPtr, m, and val.
Referenced by io_binwrite().
Definition at line 4295 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, 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, 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 4185 of file thread.c.
References GetMutexPtr, Qfalse, Qtrue, and rb_mutex_struct::th.
Referenced by Init_Thread().
Definition at line 4173 of file thread.c.
References mutex_alloc(), and rb_cMutex.
Referenced by io_binwrite().
Definition at line 4371 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 4489 of file thread.c.
References end, INT2FIX, NIL_P(), Qnil, rb_ensure(), rb_mutex_lock(), rb_mutex_sleep_forever(), rb_mutex_unlock(), rb_mutex_wait_for(), rb_time_interval(), and time.
Referenced by mutex_sleep().
Definition at line 4474 of file thread.c.
References GET_THREAD(), Qnil, and sleep_forever().
Referenced by rb_mutex_sleep().
Definition at line 4538 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 4552 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 4212 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 4426 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 4386 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 4481 of file thread.c.
References GET_THREAD(), Qnil, sleep_timeval(), and t.
Referenced by rb_mutex_sleep().
Definition at line 4138 of file thread.c.
References Qfalse, Qtrue, and rb_typeddata_is_kind_of().
Referenced by rb_objspace_call_finalizer().
Definition at line 5204 of file thread.c.
References GET_VM, Qfalse, rb_remove_event_hook(), and update_coverage().
Referenced by rb_coverage_result().
Definition at line 5197 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 2460 of file thread.c.
References rb_thread_struct::abort_on_exception, GetThreadPtr, Qfalse, Qtrue, and th.
Referenced by Init_Thread().
Definition at line 2478 of file thread.c.
References rb_thread_struct::abort_on_exception, GetThreadPtr, rb_secure(), RTEST, th, and val.
Referenced by Init_Thread().
Definition at line 2591 of file thread.c.
References GetThreadPtr, Qfalse, Qtrue, rb_threadptr_dead(), and th.
Referenced by !RTEST(), if(), Init_Thread(), and while().
Definition at line 2912 of file thread.c.
References GET_THREAD(), thread_debug, and vm_living_thread_num().
Referenced by for(), io_writable_length(), rb_thread_polling(), rb_thread_schedule_limits(), rb_thread_stop(), rb_thread_terminate_all(), rb_waitpid(), and thread_start_func_2().
Definition at line 2750 of file thread.c.
References rb_thread_local_aref(), and rb_to_id().
Referenced by Init_Thread().
Definition at line 2789 of file thread.c.
References rb_thread_local_aset(), and rb_to_id().
Referenced by Init_Thread().
Definition at line 3851 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().
Definition at line 3874 of file thread.c.
References rb_thread_atfork_internal(), and terminate_atfork_before_exec_i().
Definition at line 3820 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_foreach(), st_insert(), th, and rb_thread_struct::vm.
Referenced by rb_thread_atfork(), and rb_thread_atfork_before_exec().
Definition at line 4947 of file thread.c.
References vm_thread_backtrace_locations().
Referenced by Init_Thread().
Definition at line 4930 of file thread.c.
References 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 1372 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 1191 of file thread.c.
References ALLOC, blocking_region_begin(), FALSE, GET_THREAD(), and th.
void rb_thread_blocking_region_end | ( | struct rb_blocking_region_buffer * | region | ) |
Definition at line 1200 of file thread.c.
References blocking_region_end(), errno, RUBY_VM_CHECK_INTS_BLOCKING, th, and xfree.
Definition at line 1409 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(), r, rb_bug(), th, 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 1332 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 1325 of file thread.c.
References call_without_gvl(), func, and TRUE.
Referenced by io_flush_buffer_async2(), and rb_write_internal2().
Definition at line 1098 of file thread.c.
References GET_THREAD(), and RUBY_VM_CHECK_INTS_BLOCKING.
Referenced by bigmul1_normal(), collect_all(), for(), io_binwrite(), rb_io_wait_readable(), rb_io_wait_writable(), and trap_check().
Definition at line 1108 of file thread.c.
References rb_signal_buff_size().
Referenced by switch(), and trap_check().
Definition at line 727 of file thread.c.
References rb_cThread, rb_thread_alloc(), and thread_create_core().
Referenced by rb_detach_process().
Definition at line 2358 of file thread.c.
References GET_THREAD(), and rb_thread_struct::self.
Referenced by chdir_yield(), copy_stream_body(), dir_s_chdir(), exec_recursive(), if(), rb_autoload_load(), rb_autoloading_value(), rb_const_set(), rb_dl_get_last_error(), rb_dl_set_last_error(), recursive_list_access(), thread_s_current(), VpGetException(), VpGetPrecLimit(), and VpGetRoundMode().
Definition at line 1981 of file thread.c.
References GetThreadPtr, rb_threadptr_execute_interrupts(), and th.
Referenced by exec_interrupts(), and maygvl_copy_stream_continue_p().
Definition at line 2203 of file thread.c.
References GET_THREAD(), rb_thread_kill(), rb_thread_struct::self, and th.
Referenced by Init_Thread().
Definition at line 2086 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 3496 of file thread.c.
References do_select(), rb_fd_resize, rb_thread_sleep_forever(), and rb_thread_wait_for().
Referenced by maygvl_select(), rb_thread_select(), select_internal(), and select_single().
Definition at line 3445 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 2500 of file thread.c.
References GetThreadPtr, Qnil, th, and rb_thread_struct::thgroup.
Referenced by Init_Thread().
Definition at line 2655 of file thread.c.
References GetThreadPtr, OBJ_INFECT, rb_obj_classname(), rb_sprintf(), status, str, th, and thread_status_name().
Referenced by Init_Thread().
Definition at line 1115 of file thread.c.
References GetThreadPtr, RUBY_VM_INTERRUPTED, and 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 1339 of file thread.c.
References BLOCKING_REGION, errno, EXEC_TAG, FALSE, func, GET_THREAD(), JUMP_TAG, Qundef, RUBY_VM_CHECK_INTS_BLOCKING, state, th, 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(), rb_read_internal(), and rb_write_internal().
Definition at line 2882 of file thread.c.
References GetThreadPtr, rb_thread_struct::local_storage, Qfalse, Qtrue, rb_to_id(), st_lookup(), and th.
Referenced by Init_Thread().
Definition at line 2937 of file thread.c.
References ary, GetThreadPtr, rb_thread_struct::local_storage, rb_ary_new(), st_foreach(), th, and thread_keys_i().
Referenced by Init_Thread().
Definition at line 2141 of file thread.c.
References eKillSignal, EXIT_SUCCESS, GET_THREAD(), GetThreadPtr, rb_vm_struct::main_thread, rb_exit(), rb_secure(), rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), rb_threadptr_to_kill(), rb_thread_struct::safe_level, rb_thread_struct::status, th, thread, 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().
Definition at line 2350 of file thread.c.
References ary, GET_THREAD(), rb_ary_new(), st_foreach(), and thread_list_i().
Referenced by Init_Thread().
Definition at line 2671 of file thread.c.
References GET_THREAD(), GetThreadPtr, rb_thread_struct::local_storage, Qnil, rb_eSecurityError, rb_raise(), rb_safe_level, st_lookup(), th, and val.
Referenced by detach_process_pid(), rb_dl_get_last_error(), rb_thread_aref(), recursive_list_access(), VpGetException(), VpGetPrecLimit(), and VpGetRoundMode().
Definition at line 2756 of file thread.c.
References GET_THREAD(), GetThreadPtr, rb_thread_struct::local_storage, NIL_P(), OBJ_FROZEN, Qnil, rb_error_frozen(), rb_eSecurityError, rb_raise(), rb_safe_level, st_delete_wrap(), st_init_numtable(), st_insert(), th, and val.
Referenced by rb_detach_process(), rb_dl_set_last_error(), rb_thread_aset(), and recursive_list_access().
void rb_thread_lock_destroy | ( | rb_thread_lock_t * | lock | ) |
void rb_thread_lock_unlock | ( | rb_thread_lock_t * | lock | ) |
Definition at line 2379 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 1798 of file thread.c.
References 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().
Definition at line 1081 of file thread.c.
References GET_THREAD(), rb_thread_alone(), RUBY_VM_CHECK_INTS_BLOCKING, sleep_for_polling(), and th.
Definition at line 3035 of file thread.c.
References GetThreadPtr, INT2NUM, rb_thread_struct::priority, and th.
Referenced by Init_Thread().
Definition at line 3070 of file thread.c.
References GetThreadPtr, INT2NUM, NUM2INT, rb_thread_struct::priority, rb_secure(), RUBY_THREAD_PRIORITY_MAX, RUBY_THREAD_PRIORITY_MIN, and th.
Referenced by Init_Thread().
Definition at line 3784 of file thread.c.
Referenced by after_exec_non_async_signal_safe().
Definition at line 2272 of file thread.c.
References rb_thread_schedule(), rb_thread_wakeup(), and thread.
Referenced by if(), and Init_Thread().
Definition at line 2411 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 2442 of file thread.c.
References GET_THREAD(), rb_secure(), RTEST, rb_vm_struct::thread_abort_on_exception, val, and rb_thread_struct::vm.
Referenced by Init_Thread().
Definition at line 1747 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, r, 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, state, T_HASH, th, TH_POP_TAG, and TH_PUSH_TAG.
Referenced by Init_Thread().
Definition at line 1883 of file thread.c.
References GET_THREAD(), and rb_thread_pending_interrupt_p().
Referenced by Init_Thread().
Definition at line 2639 of file thread.c.
References GetThreadPtr, INT2NUM, rb_thread_struct::safe_level, and th.
Referenced by Init_Thread().
Definition at line 1146 of file thread.c.
References GET_THREAD(), rb_thread_schedule_limits(), rb_threadptr_execute_interrupts(), RUBY_VM_INTERRUPTED_ANY, and UNLIKELY.
Referenced by for(), if(), proc_waitall(), rb_thread_run(), rb_waitpid(), rbtk_EventCheckProc(), and thread_s_pass().
|
static |
Definition at line 1129 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, th, 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 3452 of file thread.c.
References NULL, rb_fd_copy, rb_fd_init, rb_fd_rcopy, rb_fd_term, rb_thread_fd_select(), and retval.
Definition at line 4663 of file thread.c.
References DATA_PTR(), GetThreadShieldPtr, Qfalse, Qtrue, rb_mutex_unlock(), and rb_thread_shield_waiting.
Referenced by release_thread_shield().
Definition at line 4616 of file thread.c.
References DATA_PTR(), rb_cThreadShield, rb_mutex_lock(), and thread_shield_alloc().
Referenced by load_lock().
Definition at line 4652 of file thread.c.
References GetThreadShieldPtr, Qfalse, Qtrue, rb_mutex_unlock(), and rb_thread_shield_waiting.
Referenced by release_thread_shield().
Definition at line 4632 of file thread.c.
References DATA_PTR(), GET_THREAD(), GetMutexPtr, GetThreadShieldPtr, m, 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().
Definition at line 4606 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().
Definition at line 4595 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().
Definition at line 1123 of file thread.c.
References INT2FIX, rb_thread_wait_for(), and rb_time_timeval().
Referenced by pipe_open().
Definition at line 1035 of file thread.c.
References GET_THREAD(), sleep_forever(), and thread_debug.
Referenced by rb_thread_stop().
Definition at line 1028 of file thread.c.
References GET_THREAD(), sleep_forever(), and thread_debug.
Referenced by for(), rb_f_sleep(), and rb_thread_fd_select().
Definition at line 3790 of file thread.c.
References system_working.
Referenced by after_exec_non_async_signal_safe().
|
static |
Definition at line 2562 of file thread.c.
References rb_thread_struct::errinfo, FIXNUM_P, GetThreadPtr, NIL_P(), Qfalse, Qnil, rb_str_new2, rb_threadptr_dead(), th, and thread_status_name().
Definition at line 2299 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 2614 of file thread.c.
References GetThreadPtr, Qfalse, Qtrue, rb_threadptr_dead(), rb_thread_struct::status, th, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by Init_Thread().
Definition at line 3776 of file thread.c.
Referenced by before_exec_non_async_signal_safe(), and ruby_cleanup().
Definition at line 409 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(), retry, RUBY_VM_CHECK_INTS_BLOCKING, st_foreach(), state, terminate_i(), th, TH_EXEC_TAG, TH_POP_TAG, TH_PUSH_TAG, thread_debug, and rb_thread_struct::vm.
Referenced by ruby_cleanup().
Definition at line 2825 of file thread.c.
References GET_THREAD(), GetThreadPtr, ID2SYM, rb_eSecurityError, rb_hash_aref(), rb_iv_get(), rb_raise(), rb_safe_level, rb_to_id(), and th.
Referenced by Init_Thread().
Definition at line 3003 of file thread.c.
References ID2SYM, Qfalse, Qtrue, rb_iv_get(), rb_to_id(), RHASH, and st_lookup().
Referenced by Init_Thread().
Definition at line 2850 of file thread.c.
References GET_THREAD(), GetThreadPtr, ID2SYM, OBJ_FROZEN, rb_error_frozen(), rb_eSecurityError, rb_hash_aset(), rb_iv_get(), rb_raise(), rb_safe_level, rb_to_id(), and th.
Referenced by Init_Thread().
Definition at line 2974 of file thread.c.
References ary, keys_i(), rb_ary_new(), rb_hash_foreach(), and rb_iv_get().
Referenced by Init_Thread().
Definition at line 3439 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().
Definition at line 3419 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().
Definition at line 1074 of file thread.c.
References GET_THREAD(), sleep_timeval(), and th.
Referenced by rb_f_sleep(), rb_file_flock(), rb_thread_fd_select(), rb_thread_sleep(), rsock_connect(), and while().
Definition at line 2228 of file thread.c.
References rb_eThreadError, rb_raise(), rb_thread_wakeup_alive(), RTEST, and thread.
Referenced by if(), Init_Thread(), rb_thread_run(), and while().
Definition at line 2237 of file thread.c.
References GetThreadPtr, Qnil, rb_threadptr_ready(), rb_thread_struct::status, th, thread, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by rb_thread_wakeup().
void rb_threadptr_check_signal | ( | rb_thread_t * | mth | ) |
Definition at line 3735 of file thread.c.
References rb_signal_buff_size(), and rb_threadptr_trap_interrupt().
Referenced by ruby_cleanup(), and timer_thread_function().
|
static |
Definition at line 2533 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 1899 of file thread.c.
References ATOMIC_CAS, rb_thread_struct::cfp, eKillSignal, err, eTerminateSignal, EXEC_EVENT_HOOK, FINALIZER_INTERRUPT_MASK, if(), INT2FIX, rb_thread_struct::interrupt_flag, rb_thread_struct::interrupt_mask, INTERRUPT_NONE, INTERRUPT_ON_BLOCKING, rb_vm_struct::main_thread, PENDING_INTERRUPT_MASK, rb_blocking_region_buffer::prev_status, PRIdVALUE, rb_thread_struct::priority, Qundef, rb_thread_struct::raised_flag, rb_exc_raise(), rb_gc_finalize_deferred(), rb_get_next_signal(), rb_signal_exec(), rb_thread_schedule_limits(), rb_threadptr_pending_interrupt_active_p(), rb_threadptr_pending_interrupt_deque(), rb_threadptr_to_kill(), RUBY_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, 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 347 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 330 of file thread.c.
References rb_unblock_callback::arg, rb_unblock_callback::func, 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 1612 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 1517 of file thread.c.
References i, INTERRUPT_IMMEDIATE, INTERRUPT_NEVER, INTERRUPT_NONE, INTERRUPT_ON_BLOCKING, klass, rb_thread_struct::pending_interrupt_mask_stack, Qnil, RARRAY_LEN, RARRAY_PTR(), 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 1497 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 1575 of file thread.c.
References CLASS_OF, err, i, INTERRUPT_IMMEDIATE, INTERRUPT_NEVER, INTERRUPT_NONE, INTERRUPT_ON_BLOCKING, rb_thread_struct::pending_interrupt_queue, rb_thread_struct::pending_interrupt_queue_checked, Qundef, RARRAY_LEN, RARRAY_PTR(), 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 1556 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 1503 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 1562 of file thread.c.
References e, FALSE, i, rb_thread_struct::pending_interrupt_queue, RARRAY_LEN, RARRAY_PTR(), rb_class_inherited_p(), and TRUE.
Referenced by rb_thread_pending_interrupt_p().
|
static |
Definition at line 1995 of file thread.c.
References exc, 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 1989 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 2061 of file thread.c.
References RAISED_EXCEPTION, and rb_thread_struct::raised_flag.
Referenced by error_handle(), exec_hooks(), rb_suppress_tracing(), and setup_exception().
int rb_threadptr_set_raised | ( | rb_thread_t * | th | ) |
Definition at line 2051 of file thread.c.
References RAISED_EXCEPTION, and rb_thread_struct::raised_flag.
Referenced by error_handle(), exec_hooks(), rb_suppress_tracing(), and setup_exception().
void rb_threadptr_signal_exit | ( | rb_thread_t * | th | ) |
Definition at line 2025 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 2015 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 1889 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 353 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 392 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 5211 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().
Definition at line 273 of file thread.c.
References rb_vm_struct::thread_destruct_lock.
Referenced by ruby_vm_destruct().
Definition at line 3695 of file thread.c.
References select_args::as, errno, select_args::error, select_args::except, select_args::fd, init_set_fd(), int, NULL, ptr, r, 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 4709 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 4681 of file thread.c.
References hash, list, NIL_P(), OBJ_UNTRUST, Qnil, rb_hash_aref(), rb_hash_aset(), rb_hash_new(), rb_thread_current(), rb_thread_local_aref(), rb_thread_local_aset(), RB_TYPE_P, and T_HASH.
Referenced by exec_recursive().
Definition at line 4775 of file thread.c.
References Qundef, rb_hash_delete(), rb_hash_lookup2(), RB_TYPE_P, RHASH_EMPTY_P, and T_HASH.
Referenced by exec_recursive(), and exec_recursive_i().
Definition at line 4744 of file thread.c.
References OBJ_UNTRUST, Qtrue, Qundef, rb_hash_aset(), rb_hash_lookup2(), rb_hash_new(), RB_TYPE_P, and T_HASH.
Referenced by exec_recursive(), and exec_recursive_i().
Definition at line 743 of file thread.c.
References rb_thread_struct::join_list, rb_thread_list_struct::next, p, Qnil, rb_thread_struct::status, join_arg::target, th, THREAD_KILLED, and join_arg::waiting.
Referenced by thread_join().
|
static |
Definition at line 322 of file thread.c.
References rb_thread_struct::interrupt_lock, and rb_thread_struct::unblock.
Referenced by blocking_region_end(), and rb_mutex_lock().
Definition at line 1451 of file thread.c.
References rb_thread_struct::blocking_region_buffer, and th.
Referenced by garbage_collect_with_gvl(), negative_size_allocation_error(), and ruby_memerror().
void ruby_thread_init_stack | ( | rb_thread_t * | th | ) |
Definition at line 476 of file thread.c.
Referenced by Init_BareVM().
void ruby_thread_stack_overflow | ( | rb_thread_t * | th | ) |
Definition at line 2039 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 3661 of file thread.c.
References select_args::as, errno, select_args::error, select_args::except, select_args::fd, r, 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 3683 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 293 of file thread.c.
References rb_unblock_callback::arg, 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 1065 of file thread.c.
References sleep_timeval(), timeval::tv_sec, and timeval::tv_usec.
Referenced by rb_thread_polling().
|
static |
Definition at line 946 of file thread.c.
References rb_check_deadlock(), RUBY_VM_CHECK_INTS_BLOCKING, rb_vm_struct::sleeper, rb_thread_struct::status, 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 986 of file thread.c.
References getclockofday(), RUBY_VM_CHECK_INTS_BLOCKING, rb_thread_struct::status, thread_debug, THREAD_STOPPED, TIMET_MAX, 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 1059 of file thread.c.
References double2timeval(), and sleep_timeval().
Referenced by thread_join_sleep().
Definition at line 101 of file thread.c.
References st_delete().
Referenced by rb_thread_local_aset(), and thread_start_func_2().
|
static |
Definition at line 3861 of file thread.c.
References GetThreadPtr, key, ST_CONTINUE, th, and thread_cleanup_func_before_exec().
Referenced by rb_thread_atfork_before_exec().
Definition at line 3836 of file thread.c.
References GetThreadPtr, key, rb_mutex_abandon_keeping_mutexes(), rb_mutex_abandon_locking_mutex(), ST_CONTINUE, th, thread_cleanup_func(), and TRUE.
Referenced by rb_thread_atfork().
|
static |
Definition at line 359 of file thread.c.
References eTerminateSignal, GetThreadPtr, key, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), ST_CONTINUE, th, and thread_debug.
Referenced by rb_thread_terminate_all().
Definition at line 4046 of file thread.c.
References data, thgroup::enclosed, GetThreadPtr, thgroup::group, OBJ_FROZEN, Qnil, rb_eThreadError, rb_raise(), rb_secure(), th, rb_thread_struct::thgroup, thgroup_data_type, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 3988 of file thread.c.
References data, thgroup::enclosed, thgroup::group, thgroup_data_type, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 4008 of file thread.c.
References data, thgroup::enclosed, Qfalse, Qtrue, thgroup_data_type, and TypedData_Get_Struct.
Referenced by Init_Thread().
Definition at line 3957 of file thread.c.
References thgroup_list_params::ary, ary, GET_THREAD(), thgroup_list_params::group, rb_ary_new(), st_foreach(), and thgroup_list_i().
Referenced by Init_Thread().
Definition at line 3932 of file thread.c.
References ary, GetThreadPtr, thgroup_list_params::group, rb_ary_push(), ST_CONTINUE, th, rb_thread_struct::thgroup, and thread.
Referenced by thgroup_list().
Definition at line 3914 of file thread.c.
References data, thgroup::enclosed, thgroup::group, thgroup_data_type, and TypedData_Make_Struct.
Referenced by Init_Thread().
Definition at line 454 of file thread.c.
References rb_thread_struct::interrupt_lock, rb_thread_struct::locking_mutex, Qfalse, th, and thread_cleanup_func_before_exec().
Referenced by terminate_atfork_i().
Definition at line 443 of file thread.c.
References rb_thread_struct::machine_stack_end, rb_thread_struct::machine_stack_start, rb_thread_struct::status, th, and THREAD_KILLED.
Referenced by terminate_atfork_before_exec_i(), and thread_cleanup_func().
Definition at line 608 of file thread.c.
References args, err, rb_thread_struct::first_args, rb_thread_struct::first_func, rb_thread_struct::first_proc, GET_THREAD(), GetThreadPtr, 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, st_insert(), rb_thread_struct::status, 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 2071 of file thread.c.
References err, GetThreadPtr, int, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), ruby_error_closed_stream, rb_vm_struct::special_exceptions, ST_CONTINUE, th, rb_thread_struct::vm, and rb_thread_struct::waiting_fd.
Referenced by rb_thread_fd_close().
Definition at line 702 of file thread.c.
References rb_thread_struct::first_args, rb_thread_struct::first_proc, GetThreadPtr, NIL_P(), NUM2INT, proc, RARRAY_PTR(), rb_block_given_p(), rb_eThreadError, rb_proc_location(), rb_raise(), RSTRING_PTR, RTEST, th, and thread_create_core().
Referenced by Init_Thread().
|
static |
Definition at line 790 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, rb_thread_list_struct::next, 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, rb_thread_list_struct::th, th, 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 882 of file thread.c.
References DELAY_INFTY, GetThreadPtr, join_arg::limit, NIL_P(), rb_num2dbl(), rb_scan_args(), and thread_join().
Referenced by Init_Thread().
Definition at line 764 of file thread.c.
References join_arg::forever, join_arg::limit, p, Qfalse, Qtrue, sleep_forever(), sleep_wait_for_interrupt(), rb_thread_struct::status, join_arg::target, th, thread_debug, rb_thread_struct::thread_id, THREAD_KILLED, timeofday(), and join_arg::waiting.
Referenced by thread_join().
Definition at line 2899 of file thread.c.
References ID2SYM, rb_ary_push(), and ST_CONTINUE.
Referenced by rb_thread_keys().
Definition at line 2310 of file thread.c.
References ary, GetThreadPtr, rb_ary_push(), rb_thread_struct::self, ST_CONTINUE, rb_thread_struct::status, th, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Referenced by rb_thread_list().
Definition at line 2113 of file thread.c.
References GET_THREAD(), GetThreadPtr, Qnil, rb_threadptr_raise(), RUBY_VM_CHECK_INTS, and th.
Referenced by Init_Thread().
Definition at line 2373 of file thread.c.
References rb_thread_current().
Referenced by Init_Thread().
Definition at line 667 of file thread.c.
References rb_thread_struct::first_args, GET_VM, GetThreadPtr, rb_class2name(), rb_eThreadError, rb_obj_call_init(), rb_raise(), rb_thread_alloc(), th, thread, and THREAD_KILLED.
Referenced by Init_Thread().
Definition at line 1472 of file thread.c.
References Qnil, and rb_thread_schedule().
Referenced by Init_Thread().
Definition at line 4584 of file thread.c.
References mutex_alloc(), and TypedData_Wrap_Struct.
Referenced by rb_thread_shield_new().
Definition at line 4573 of file thread.c.
References rb_gc_mark().
Definition at line 695 of file thread.c.
References rb_thread_alloc(), and thread_create_core().
Referenced by Init_Thread().
|
static |
Definition at line 482 of file thread.c.
References rb_thread_struct::abort_on_exception, args, rb_proc_t::block, rb_block_struct::ep, rb_thread_struct::errinfo, EXEC_EVENT_HOOK, EXEC_TAG, rb_thread_struct::first_args, rb_thread_struct::first_func, rb_thread_struct::first_proc, GetProcPtr, rb_thread_struct::join_list, rb_vm_struct::living_threads, rb_thread_struct::locking_mutex, rb_thread_struct::machine_stack_start, rb_vm_struct::main_thread, rb_thread_list_struct::next, PRIxVALUE, proc, Qfalse, Qnil, Qundef, RARRAY_LEN, RARRAY_PTR(), 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_vm_ep_local_ep(), rb_vm_invoke_proc(), rb_thread_struct::root_fiber, rb_thread_struct::root_lep, rb_thread_struct::root_svar, RTEST, ruby_debug, RUBY_EVENT_THREAD_BEGIN, RUBY_EVENT_THREAD_END, ruby_stop(), rb_thread_struct::safe_level, SAVE_ROOT_JMPBUF, rb_thread_struct::self, st_delete_wrap(), rb_thread_struct::stack, state, rb_thread_struct::status, T_OBJECT, TAG_FATAL, rb_thread_list_struct::th, TH_POP_TAG, TH_PUSH_TAG, rb_vm_struct::thread_abort_on_exception, thread_debug, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, rb_thread_struct::value, and rb_thread_struct::vm.
|
static |
Definition at line 2514 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 913 of file thread.c.
References DELAY_INFTY, GetThreadPtr, th, thread_join(), and rb_thread_struct::value.
Referenced by Init_Thread().
|
static |
Definition at line 1042 of file thread.c.
References e, 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().
Definition at line 3745 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 5174 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_PTR(), rb_sourceline(), and RBASIC.
Referenced by rb_reset_coverages(), and rb_set_coverages().
Definition at line 2906 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 |
|
static |
VALUE rb_cMutex |
Definition at line 79 of file thread.c.
Referenced by Init_Thread(), and rb_mutex_new().
VALUE rb_cThreadShield |
Definition at line 80 of file thread.c.
Referenced by rb_thread_shield_new().
|
static |
Definition at line 82 of file thread.c.
Referenced by handle_interrupt_arg_check_i(), Init_Thread(), and rb_threadptr_pending_interrupt_check_mask().
|
static |
Definition at line 84 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 83 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 |
Definition at line 3890 of file thread.c.
Referenced by thgroup_add(), thgroup_enclose(), thgroup_enclosed_p(), and thgroup_s_alloc().
|
static |