Ruby
2.5.0dev(2017-10-22revision60238)
|
#include "eval_intern.h"
#include "gc.h"
#include "timev.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/thread_native.h"
#include "ruby/debug.h"
#include "internal.h"
#include "thread_sync.c"
Go to the source code of this file.
Data Structures | |
struct | waiting_fd |
struct | rb_blocking_region_buffer |
struct | join_arg |
struct | select_args |
struct | thgroup |
struct | exec_recursive_params |
Enumerations | |
enum | handle_interrupt_timing { INTERRUPT_NONE, INTERRUPT_IMMEDIATE, INTERRUPT_ON_BLOCKING, INTERRUPT_NEVER } |
#define BLOCKING_REGION | ( | exec, | |
ubf, | |||
ubfarg, | |||
fail_if_interrupted | |||
) |
Definition at line 165 of file thread.c.
Referenced by rb_thread_io_blocking_region().
#define do_select_update | ( | ) |
#define fd_init_copy | ( | f | ) | (f##fds) ? rb_fd_init_copy(&orig_##f, f##fds) : rb_fd_no_init(&orig_##f) |
#define fd_term | ( | f | ) | if (f##fds) rb_fd_term(&orig_##f) |
#define GetThreadShieldPtr | ( | obj | ) | ((VALUE)rb_check_typeddata((obj), &thread_shield_data_type)) |
Definition at line 4395 of file thread.c.
Referenced by rb_thread_shield_wait().
#define GVL_UNLOCK_BEGIN | ( | ) |
#define GVL_UNLOCK_END | ( | ) |
#define OBJ_ID_EQL | ( | obj_id, | |
other | |||
) | ((obj_id) == (other)) |
#define RB_GC_SAVE_MACHINE_CONTEXT | ( | th | ) |
#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) |
#define restore_fdset | ( | fds1, | |
fds2 | |||
) | ((fds1) ? rb_fd_dup(fds1, fds2) : (void)0) |
#define RUBY_VM_CHECK_INTS_BLOCKING | ( | th | ) | vm_check_ints_blocking(th) |
Definition at line 176 of file thread.c.
Referenced by rb_thread_check_ints(), and rb_thread_io_blocking_region().
#define thread_debug if(0)printf |
Definition at line 273 of file thread.c.
Referenced by rb_thread_sleep_deadly(), rb_thread_sleep_forever(), and rb_thread_terminate_all().
#define thread_start_func_2 | ( | th, | |
st, | |||
rst | |||
) | thread_start_func_2(th, st) |
#define threadptr_initialized | ( | th | ) | ((th)->first_args != 0) |
void Init_Thread | ( | void | ) |
Definition at line 4796 of file thread.c.
References GET_THREAD.
NOINLINE | ( | static int | thread_start_func_2rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start | ) |
Definition at line 4709 of file thread.c.
Referenced by rb_invcmp(), and rb_io_puts().
VALUE rb_exec_recursive_paired | ( | VALUE(*)(VALUE, VALUE, int) | func, |
VALUE | obj, | ||
VALUE | paired_obj, | ||
VALUE | arg | ||
) |
Definition at line 4720 of file thread.c.
Referenced by rb_ary_cmp().
VALUE rb_get_coverages | ( | void | ) |
void rb_nativethread_lock_destroy | ( | rb_nativethread_lock_t * | lock | ) |
void rb_nativethread_lock_initialize | ( | rb_nativethread_lock_t * | lock | ) |
void rb_nativethread_lock_lock | ( | rb_nativethread_lock_t * | lock | ) |
void rb_nativethread_lock_unlock | ( | rb_nativethread_lock_t * | lock | ) |
int rb_notify_fd_close | ( | int | fd | ) |
Definition at line 2193 of file thread.c.
References err, waiting_fd::fd, GET_THREAD, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), ruby_error_stream_closed, rb_vm_struct::special_exceptions, waiting_fd::th, rb_thread_struct::vm, rb_vm_struct::waiting_fds, and waiting_fd::wfd_node.
Referenced by rb_thread_fd_close().
void rb_reset_coverages | ( | void | ) |
Definition at line 5072 of file thread.c.
References rb_get_coverages(), rb_hash_tbl_raw(), and st_foreach.
void rb_set_coverages | ( | VALUE | coverages, |
int | mode | ||
) |
Definition at line 5050 of file thread.c.
References GET_VM, and rb_add_event_hook2().
int rb_thread_alone | ( | void | ) |
Definition at line 3273 of file thread.c.
Referenced by rb_thread_stop().
void* rb_thread_call_with_gvl | ( | void *(*)(void *) | func, |
void * | data1 | ||
) |
Definition at line 1501 of file thread.c.
References rb_thread_struct::blocking_region_buffer, EXIT_FAILURE, if(), rb_bug(), and rb_thread_struct::unblock.
void* rb_thread_call_without_gvl | ( | void *(*)(void *data) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
void* rb_thread_call_without_gvl2 | ( | void *(*)(void *) | func, |
void * | data1, | ||
rb_unblock_function_t * | ubf, | ||
void * | data2 | ||
) |
void rb_thread_check_ints | ( | void | ) |
Definition at line 1219 of file thread.c.
References GET_THREAD, and RUBY_VM_CHECK_INTS_BLOCKING.
int rb_thread_check_trap_pending | ( | void | ) |
Definition at line 1230 of file thread.c.
References rb_signal_buff_size().
Definition at line 831 of file thread.c.
Referenced by rb_detach_process().
VALUE rb_thread_current | ( | void | ) |
Definition at line 2494 of file thread.c.
References GET_THREAD.
Referenced by VpGetPrecLimit(), and VpGetRoundMode().
void rb_thread_execute_interrupts | ( | VALUE | thval | ) |
Definition at line 2107 of file thread.c.
References rb_threadptr_execute_interrupts().
void rb_thread_fd_close | ( | int | fd | ) |
Definition at line 2219 of file thread.c.
References rb_notify_fd_close(), and rb_thread_schedule().
int rb_thread_fd_select | ( | int | max, |
rb_fdset_t * | read, | ||
rb_fdset_t * | write, | ||
rb_fdset_t * | except, | ||
struct timeval * | timeout | ||
) |
Definition at line 3789 of file thread.c.
References rb_fd_resize, rb_thread_sleep_forever(), and rb_thread_wait_for().
int rb_thread_interrupted | ( | VALUE | thval | ) |
Definition at line 1237 of file thread.c.
References RUBY_VM_INTERRUPTED.
VALUE rb_thread_io_blocking_region | ( | rb_blocking_function_t * | func, |
void * | data1, | ||
int | fd | ||
) |
Definition at line 1436 of file thread.c.
References BLOCKING_REGION, errno, EXEC_TAG, FALSE, waiting_fd::fd, GET_THREAD, GET_VM, Qundef, RUBY_VM_CHECK_INTS_BLOCKING, TAG_NONE, waiting_fd::th, TH_JUMP_TAG, TH_POP_TAG, TH_PUSH_TAG, val, rb_vm_struct::waiting_fds, and waiting_fd::wfd_node.
VALUE rb_thread_list | ( | void | ) |
Definition at line 2474 of file thread.c.
References GET_THREAD, rb_vm_struct::living_threads, rb_ary_new(), rb_ary_push(), rb_thread_struct::self, rb_thread_struct::status, THREAD_RUNNABLE, THREAD_STOPPED, and THREAD_STOPPED_FOREVER.
Definition at line 3013 of file thread.c.
Referenced by VpGetPrecLimit(), and VpGetRoundMode().
Definition at line 3148 of file thread.c.
References OBJ_FROZEN, and rb_error_frozen().
VALUE rb_thread_main | ( | void | ) |
Definition at line 2515 of file thread.c.
References GET_THREAD.
Definition at line 2417 of file thread.c.
References rb_thread_schedule(), and rb_thread_wakeup().
void rb_thread_schedule | ( | void | ) |
Definition at line 1266 of file thread.c.
References GET_THREAD.
Referenced by rb_thread_fd_close(), and rb_thread_run().
Definition at line 4438 of file thread.c.
References GET_THREAD, GetMutexPtr, GetThreadShieldPtr, Qfalse, Qnil, and rb_mutex_struct::th.
void rb_thread_sleep | ( | int | sec | ) |
Definition at line 1243 of file thread.c.
References INT2FIX, rb_thread_wait_for(), and rb_time_timeval().
void rb_thread_sleep_deadly | ( | void | ) |
void rb_thread_sleep_forever | ( | void | ) |
Definition at line 1160 of file thread.c.
References thread_debug.
Referenced by rb_thread_fd_select().
VALUE rb_thread_stop | ( | void | ) |
Definition at line 2441 of file thread.c.
References Qnil, rb_eThreadError, rb_raise(), rb_thread_alone(), and rb_thread_sleep_deadly().
void rb_thread_terminate_all | ( | void | ) |
Definition at line 479 of file thread.c.
References GET_THREAD, rb_vm_struct::main_thread, rb_bug(), rb_threadptr_unlock_all_locking_mutexes(), TAG_NONE, TH_EXEC_TAG, TH_PUSH_TAG, thread_debug, and rb_thread_struct::vm.
void rb_thread_wait_fd | ( | int | fd | ) |
Definition at line 3776 of file thread.c.
Referenced by rb_io_read_check().
void rb_thread_wait_for | ( | struct timeval | time | ) |
Definition at line 1205 of file thread.c.
References GET_THREAD.
Referenced by rb_thread_fd_select(), and rb_thread_sleep().
Definition at line 2370 of file thread.c.
References rb_eThreadError, rb_raise(), rb_thread_wakeup_alive(), and RTEST.
Referenced by rb_thread_run().
Definition at line 2379 of file thread.c.
Referenced by rb_thread_wakeup().
void rb_threadptr_check_signal | ( | rb_thread_t * | mth | ) |
Definition at line 4029 of file thread.c.
References rb_signal_buff_size(), and rb_threadptr_trap_interrupt().
Referenced by ruby_cleanup().
void rb_threadptr_execute_interrupts | ( | rb_thread_t * | th, |
int | blocking_timing | ||
) |
Definition at line 2029 of file thread.c.
References rb_thread_struct::ec, and rb_execution_context_struct::raised_flag.
Referenced by rb_thread_execute_interrupts().
void rb_threadptr_interrupt | ( | rb_thread_t * | th | ) |
Definition at line 433 of file thread.c.
Referenced by rb_notify_fd_close(), and ruby_cleanup().
int rb_threadptr_pending_interrupt_active_p | ( | rb_thread_t * | th | ) |
Definition at line 1716 of file thread.c.
References rb_thread_struct::pending_interrupt_queue_checked.
void rb_threadptr_pending_interrupt_clear | ( | rb_thread_t * | th | ) |
Definition at line 1589 of file thread.c.
References rb_thread_struct::pending_interrupt_queue, and rb_ary_clear().
void rb_threadptr_pending_interrupt_enque | ( | rb_thread_t * | th, |
VALUE | v | ||
) |
Definition at line 1595 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(), and rb_notify_fd_close().
int rb_threadptr_reset_raised | ( | rb_thread_t * | th | ) |
Definition at line 2183 of file thread.c.
References rb_thread_struct::ec, RAISED_EXCEPTION, and rb_execution_context_struct::raised_flag.
int rb_threadptr_set_raised | ( | rb_thread_t * | th | ) |
Definition at line 2173 of file thread.c.
References rb_thread_struct::ec, RAISED_EXCEPTION, and rb_execution_context_struct::raised_flag.
void rb_threadptr_setup_exception | ( | rb_thread_t * | th, |
VALUE | mesg, | ||
VALUE | cause | ||
) |
void rb_threadptr_signal_exit | ( | rb_thread_t * | th | ) |
Definition at line 2159 of file thread.c.
References rb_eSystemExit, and rb_str_new2.
Referenced by rb_signal_exec().
void rb_threadptr_signal_raise | ( | rb_thread_t * | th, |
int | sig | ||
) |
Definition at line 2149 of file thread.c.
References INT2FIX, and rb_eSignal.
Referenced by rb_signal_exec().
void rb_threadptr_trap_interrupt | ( | rb_thread_t * | th | ) |
Definition at line 439 of file thread.c.
Referenced by rb_threadptr_check_signal().
void rb_threadptr_unlock_all_locking_mutexes | ( | rb_thread_t * | th | ) |
Definition at line 462 of file thread.c.
References err, rb_thread_struct::keeping_mutexes, and rb_mutex_struct::next_mutex.
Referenced by rb_thread_terminate_all().
Definition at line 5128 of file thread.c.
References GET_THREAD, rb_cObject, rb_hash_aset(), and rb_ident_hash_new().
void rb_vm_gvl_destroy | ( | rb_vm_t * | vm | ) |
Definition at line 348 of file thread.c.
References rb_vm_struct::thread_destruct_lock.
Definition at line 565 of file thread.c.
Referenced by rb_fiber_start().
int rb_wait_for_single_fd | ( | int | fd, |
int | events, | ||
struct timeval * | tv | ||
) |
Definition at line 3989 of file thread.c.
References select_args::as, waiting_fd::fd, select_args::fd, RB_WAITFD_IN, and select_args::read.
int ruby_thread_has_gvl_p | ( | void | ) |
Definition at line 1543 of file thread.c.
References rb_thread_struct::blocking_region_buffer.
void ruby_thread_init_stack | ( | rb_thread_t * | th | ) |