thread.c File Reference

#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

Defines

#define __USE_FORTIFY_LEVEL   0
#define USE_NATIVE_THREAD_PRIORITY   0
#define RUBY_THREAD_PRIORITY_MAX   3
#define RUBY_THREAD_PRIORITY_MIN   -3
#define THREAD_DEBUG   0
#define eKillSignal   INT2FIX(0)
#define eTerminateSignal   INT2FIX(1)
#define closed_stream_error   GET_VM()->special_exceptions[ruby_error_closed_stream]
#define THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
#define RB_GC_SAVE_MACHINE_REGISTER_STACK(th)
#define RB_GC_SAVE_MACHINE_CONTEXT(th)
#define GVL_UNLOCK_BEGIN()
#define GVL_UNLOCK_END()
#define only_if_constant(expr, notconst)   notconst
#define BLOCKING_REGION(exec, ubf, ubfarg, fail_if_interrupted)
#define thread_debug   if(0)printf
#define thread_start_func_2(th, st, rst)   thread_start_func_2(th, st)
#define DELAY_INFTY   1E30
#define rb_fd_rcopy(d, s)   (*(d) = *(s))
#define GetMutexPtr(obj, tobj)   TypedData_Get_Struct((obj), rb_mutex_t, &mutex_data_type, (tobj))
#define mutex_mark   NULL
#define GetThreadShieldPtr(obj)   ((VALUE)rb_check_typeddata((obj), &thread_shield_data_type))
#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)
#define THREAD_SHIELD_WAITING_SHIFT   (FL_USHIFT)
#define rb_thread_shield_waiting(b)   (int)((RBASIC(b)->flags&THREAD_SHIELD_WAITING_MASK)>>THREAD_SHIELD_WAITING_SHIFT)
#define OBJ_ID_EQL(obj_id, other)   ((obj_id) == (other))
#define rb_intern(str)   rb_intern_const(str)

Typedefs

typedef rb_mutex_struct rb_mutex_t

Enumerations

enum  handle_interrupt_timing { INTERRUPT_NONE, INTERRUPT_IMMEDIATE, INTERRUPT_ON_BLOCKING, INTERRUPT_NEVER }

Functions

static void sleep_timeval (rb_thread_t *th, struct timeval time, int spurious_check)
static void sleep_wait_for_interrupt (rb_thread_t *th, double sleepsec, int spurious_check)
static void sleep_forever (rb_thread_t *th, int nodeadlock, int spurious_check)
static double timeofday (void)
static int rb_threadptr_dead (rb_thread_t *th)
static void rb_check_deadlock (rb_vm_t *vm)
static int rb_threadptr_pending_interrupt_empty_p (rb_thread_t *th)
static void st_delete_wrap (st_table *table, st_data_t key)
static int set_unblock_function (rb_thread_t *th, rb_unblock_function_t *func, void *arg, struct rb_unblock_callback *old, int fail_if_interrupted)
static void reset_unblock_function (rb_thread_t *th, const struct rb_unblock_callback *old)
static int blocking_region_begin (rb_thread_t *th, struct rb_blocking_region_buffer *region, rb_unblock_function_t *ubf, void *arg, int fail_if_interrupted)
static void blocking_region_end (rb_thread_t *th, struct rb_blocking_region_buffer *region)
 NOINLINE (static int thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start))
static void timer_thread_function (void *)
void rb_vm_gvl_destroy (rb_vm_t *vm)
void rb_nativethread_lock_initialize (rb_nativethread_lock_t *lock)
void rb_nativethread_lock_destroy (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)
static void rb_threadptr_interrupt_common (rb_thread_t *th, int trap)
void rb_threadptr_interrupt (rb_thread_t *th)
void rb_threadptr_trap_interrupt (rb_thread_t *th)
static int terminate_i (st_data_t key, st_data_t val, rb_thread_t *main_thread)
static void rb_mutex_abandon_all (rb_mutex_t *mutexes)
static void rb_mutex_abandon_keeping_mutexes (rb_thread_t *th)
static void rb_mutex_abandon_locking_mutex (rb_thread_t *th)
static const char * rb_mutex_unlock_th (rb_mutex_t *mutex, rb_thread_t volatile *th)
void rb_threadptr_unlock_all_locking_mutexes (rb_thread_t *th)
void rb_thread_terminate_all (void)
static void thread_cleanup_func_before_exec (void *th_ptr)
static void thread_cleanup_func (void *th_ptr, int atfork)
static VALUE rb_threadptr_raise (rb_thread_t *, int, VALUE *)
void ruby_thread_init_stack (rb_thread_t *th)
static int thread_start_func_2 (rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start)
static VALUE thread_create_core (VALUE thval, VALUE args, VALUE(*fn)(ANYARGS))
static VALUE thread_s_new (int argc, VALUE *argv, VALUE klass)
static VALUE thread_start (VALUE klass, VALUE args)
static VALUE thread_initialize (VALUE thread, VALUE args)
VALUE rb_thread_create (VALUE(*fn)(ANYARGS), void *arg)
static VALUE remove_from_join_list (VALUE arg)
static VALUE thread_join_sleep (VALUE arg)
static VALUE thread_join (rb_thread_t *target_th, double delay)
static VALUE thread_join_m (int argc, VALUE *argv, VALUE self)
static VALUE thread_value (VALUE self)
static struct timeval double2timeval (double d)
static void getclockofday (struct timeval *tp)
void rb_thread_sleep_forever (void)
void rb_thread_sleep_deadly (void)
static void sleep_for_polling (rb_thread_t *th)
void rb_thread_wait_for (struct timeval time)
void rb_thread_polling (void)
void rb_thread_check_ints (void)
int rb_thread_check_trap_pending (void)
int rb_thread_interrupted (VALUE thval)
void rb_thread_sleep (int sec)
static void rb_thread_schedule_limits (unsigned long limits_us)
void rb_thread_schedule (void)
rb_blocking_region_bufferrb_thread_blocking_region_begin (void)
void rb_thread_blocking_region_end (struct rb_blocking_region_buffer *region)
static void * call_without_gvl (void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2, int fail_if_interrupted)
void * rb_thread_call_without_gvl2 (void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2)
void * rb_thread_call_without_gvl (void *(*func)(void *data), void *data1, rb_unblock_function_t *ubf, void *data2)
VALUE rb_thread_io_blocking_region (rb_blocking_function_t *func, void *data1, int fd)
VALUE rb_thread_blocking_region (rb_blocking_function_t *func, void *data1, rb_unblock_function_t *ubf, void *data2)
void * rb_thread_call_with_gvl (void *(*func)(void *), void *data1)
int ruby_thread_has_gvl_p (void)
static VALUE thread_s_pass (VALUE klass)
void rb_threadptr_pending_interrupt_clear (rb_thread_t *th)
void rb_threadptr_pending_interrupt_enque (rb_thread_t *th, VALUE v)
static enum handle_interrupt_timing rb_threadptr_pending_interrupt_check_mask (rb_thread_t *th, VALUE err)
static int rb_threadptr_pending_interrupt_include_p (rb_thread_t *th, VALUE err)
static VALUE rb_threadptr_pending_interrupt_deque (rb_thread_t *th, enum handle_interrupt_timing timing)
int rb_threadptr_pending_interrupt_active_p (rb_thread_t *th)
static int handle_interrupt_arg_check_i (VALUE key, VALUE val)
static VALUE rb_thread_s_handle_interrupt (VALUE self, VALUE mask_arg)
static VALUE rb_thread_pending_interrupt_p (int argc, VALUE *argv, VALUE target_thread)
static VALUE rb_thread_s_pending_interrupt_p (int argc, VALUE *argv, VALUE self)
static void rb_threadptr_to_kill (rb_thread_t *th)
static rb_atomic_t threadptr_get_interrupts (rb_thread_t *th)
void rb_threadptr_execute_interrupts (rb_thread_t *th, int blocking_timing)
void rb_thread_execute_interrupts (VALUE thval)
static void rb_threadptr_ready (rb_thread_t *th)
void rb_threadptr_signal_raise (rb_thread_t *th, int sig)
void rb_threadptr_signal_exit (rb_thread_t *th)
void ruby_thread_stack_overflow (rb_thread_t *th)
int rb_threadptr_set_raised (rb_thread_t *th)
int rb_threadptr_reset_raised (rb_thread_t *th)
static int thread_fd_close_i (st_data_t key, st_data_t val, st_data_t data)
void rb_thread_fd_close (int fd)
static VALUE thread_raise_m (int argc, VALUE *argv, VALUE self)
VALUE rb_thread_kill (VALUE thread)
static VALUE rb_thread_s_kill (VALUE obj, VALUE th)
static VALUE rb_thread_exit (void)
VALUE rb_thread_wakeup (VALUE thread)
VALUE rb_thread_wakeup_alive (VALUE thread)
VALUE rb_thread_run (VALUE thread)
VALUE rb_thread_stop (void)
static int thread_list_i (st_data_t key, st_data_t val, void *data)
VALUE rb_thread_list (void)
VALUE rb_thread_current (void)
static VALUE thread_s_current (VALUE klass)
VALUE rb_thread_main (void)
static VALUE rb_thread_s_main (VALUE klass)
static VALUE rb_thread_s_abort_exc (void)
static VALUE rb_thread_s_abort_exc_set (VALUE self, VALUE val)
static VALUE rb_thread_abort_exc (VALUE thread)
static VALUE rb_thread_abort_exc_set (VALUE thread, VALUE val)
VALUE rb_thread_group (VALUE thread)
static const char * thread_status_name (rb_thread_t *th)
static VALUE rb_thread_status (VALUE thread)
static VALUE rb_thread_alive_p (VALUE thread)
static VALUE rb_thread_stop_p (VALUE thread)
static VALUE rb_thread_safe_level (VALUE thread)
static VALUE rb_thread_inspect (VALUE thread)
static VALUE threadptr_local_aref (rb_thread_t *th, ID id)
VALUE rb_thread_local_aref (VALUE thread, ID id)
static VALUE rb_thread_aref (VALUE thread, VALUE key)
static VALUE threadptr_local_aset (rb_thread_t *th, ID id, VALUE val)
VALUE rb_thread_local_aset (VALUE thread, ID id, VALUE val)
static VALUE rb_thread_aset (VALUE self, VALUE id, VALUE val)
static VALUE rb_thread_variable_get (VALUE thread, VALUE key)
static VALUE rb_thread_variable_set (VALUE thread, VALUE id, VALUE val)
static VALUE rb_thread_key_p (VALUE self, VALUE key)
static int thread_keys_i (ID key, VALUE value, VALUE ary)
static int vm_living_thread_num (rb_vm_t *vm)
int rb_thread_alone (void)
static VALUE rb_thread_keys (VALUE self)
static int keys_i (VALUE key, VALUE value, VALUE ary)
static VALUE rb_thread_variables (VALUE thread)
static VALUE rb_thread_variable_p (VALUE thread, VALUE key)
static VALUE rb_thread_priority (VALUE thread)
static VALUE rb_thread_priority_set (VALUE thread, VALUE prio)
static int do_select (int n, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, struct timeval *timeout)
static void rb_thread_wait_fd_rw (int fd, int read)
void rb_thread_wait_fd (int fd)
int rb_thread_fd_writable (int fd)
int rb_thread_select (int max, fd_set *read, fd_set *write, fd_set *except, struct timeval *timeout)
int rb_thread_fd_select (int max, rb_fdset_t *read, rb_fdset_t *write, rb_fdset_t *except, struct timeval *timeout)
static rb_fdset_tinit_set_fd (int fd, rb_fdset_t *fds)
static VALUE select_single (VALUE ptr)
static VALUE select_single_cleanup (VALUE ptr)
int rb_wait_for_single_fd (int fd, int events, struct timeval *tv)
void rb_gc_set_stack_end (VALUE **stack_end_p)
void rb_threadptr_check_signal (rb_thread_t *mth)
void rb_thread_stop_timer_thread (int close_anyway)
void rb_thread_reset_timer_thread (void)
void rb_thread_start_timer_thread (void)
static int clear_coverage_i (st_data_t key, st_data_t val, st_data_t dummy)
static void clear_coverage (void)
static void rb_thread_atfork_internal (int(*atfork)(st_data_t, st_data_t, st_data_t))
static int terminate_atfork_i (st_data_t key, st_data_t val, st_data_t current_th)
void rb_thread_atfork (void)
static int terminate_atfork_before_exec_i (st_data_t key, st_data_t val, st_data_t current_th)
void rb_thread_atfork_before_exec (void)
static size_t thgroup_memsize (const void *ptr)
static VALUE thgroup_s_alloc (VALUE klass)
static int thgroup_list_i (st_data_t key, st_data_t val, st_data_t data)
static VALUE thgroup_list (VALUE group)
static VALUE thgroup_enclose (VALUE group)
static VALUE thgroup_enclosed_p (VALUE group)
static VALUE thgroup_add (VALUE group, VALUE thread)
static void mutex_free (void *ptr)
static size_t mutex_memsize (const void *ptr)
VALUE rb_obj_is_mutex (VALUE obj)
static VALUE mutex_alloc (VALUE klass)
static VALUE mutex_initialize (VALUE self)
VALUE rb_mutex_new (void)
VALUE rb_mutex_locked_p (VALUE self)
static void mutex_locked (rb_thread_t *th, VALUE self)
VALUE rb_mutex_trylock (VALUE self)
static int lock_func (rb_thread_t *th, rb_mutex_t *mutex, int timeout_ms)
static void lock_interrupt (void *ptr)
VALUE rb_mutex_lock (VALUE self)
VALUE rb_mutex_owned_p (VALUE self)
VALUE rb_mutex_unlock (VALUE self)
static VALUE rb_mutex_sleep_forever (VALUE time)
static VALUE rb_mutex_wait_for (VALUE time)
VALUE rb_mutex_sleep (VALUE self, VALUE timeout)
static VALUE mutex_sleep (int argc, VALUE *argv, VALUE self)
VALUE rb_mutex_synchronize (VALUE mutex, VALUE(*func)(VALUE arg), VALUE arg)
static VALUE rb_mutex_synchronize_m (VALUE self, VALUE args)
void rb_mutex_allow_trap (VALUE self, int val)
static void thread_shield_mark (void *ptr)
static VALUE thread_shield_alloc (VALUE klass)
static void rb_thread_shield_waiting_inc (VALUE b)
static void rb_thread_shield_waiting_dec (VALUE b)
VALUE rb_thread_shield_new (void)
VALUE rb_thread_shield_wait (VALUE self)
VALUE rb_thread_shield_release (VALUE self)
VALUE rb_thread_shield_destroy (VALUE self)
static VALUE ident_hash_new (void)
static VALUE recursive_list_access (void)
VALUE rb_threadptr_reset_recursive_data (rb_thread_t *th)
void rb_threadptr_restore_recursive_data (rb_thread_t *th, VALUE old)
static VALUE recursive_check (VALUE list, VALUE obj_id, VALUE paired_obj_id)
static void recursive_push (VALUE list, VALUE obj, VALUE paired_obj)
static void recursive_pop (VALUE list, VALUE obj, VALUE paired_obj)
static VALUE exec_recursive_i (RB_BLOCK_CALL_FUNC_ARGLIST(tag, data))
static VALUE exec_recursive (VALUE(*func)(VALUE, VALUE, int), VALUE obj, VALUE pairid, VALUE arg, int outer)
VALUE rb_exec_recursive (VALUE(*func)(VALUE, VALUE, int), VALUE obj, VALUE arg)
VALUE rb_exec_recursive_paired (VALUE(*func)(VALUE, VALUE, int), VALUE obj, VALUE paired_obj, VALUE arg)
VALUE rb_exec_recursive_outer (VALUE(*func)(VALUE, VALUE, int), VALUE obj, VALUE arg)
VALUE rb_exec_recursive_paired_outer (VALUE(*func)(VALUE, VALUE, int), VALUE obj, VALUE paired_obj, VALUE arg)
static VALUE rb_thread_backtrace_m (int argc, VALUE *argv, VALUE thval)
static VALUE rb_thread_backtrace_locations_m (int argc, VALUE *argv, VALUE thval)
void Init_Thread (void)
int ruby_native_thread_p (void)
static int check_deadlock_i (st_data_t key, st_data_t val, int *found)
static void update_coverage (rb_event_flag_t event, VALUE proc, VALUE self, ID id, VALUE klass)
VALUE rb_get_coverages (void)
void rb_set_coverages (VALUE coverages)
void rb_reset_coverages (void)
VALUE rb_uninterruptible (VALUE(*b_proc)(ANYARGS), VALUE data)
void ruby_kill (rb_pid_t pid, int sig)

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_tpatrol_thread = NULL
static const rb_data_type_t thread_shield_data_type
static ID recursive_key
st_hash_type st_hashtype_num


Define Documentation

#define __USE_FORTIFY_LEVEL   0

Definition at line 56 of file thread.c.

#define BLOCKING_REGION ( exec,
ubf,
ubfarg,
fail_if_interrupted   ) 

Value:

do { \
    rb_thread_t *__th = GET_THREAD(); \
    struct rb_blocking_region_buffer __region; \
    if (blocking_region_begin(__th, &__region, (ubf), (ubfarg), fail_if_interrupted) || \
        /* always return true unless fail_if_interrupted */ \
        !only_if_constant(fail_if_interrupted, TRUE)) { \
        exec; \
        blocking_region_end(__th, &__region); \
    }; \
} while(0)

Definition at line 151 of file thread.c.

#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 4182 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 4671 of file thread.c.

Referenced by rb_thread_shield_destroy(), rb_thread_shield_release(), and rb_thread_shield_wait().

 
#define GVL_UNLOCK_BEGIN (  ) 

Value:

do { \
  rb_thread_t *_th_stored = GET_THREAD(); \
  RB_GC_SAVE_MACHINE_CONTEXT(_th_stored); \
  gvl_release(_th_stored->vm);

Definition at line 136 of file thread.c.

Referenced by rb_mutex_lock(), and ruby_kill().

 
#define GVL_UNLOCK_END (  ) 

Value:

gvl_acquire(_th_stored->vm, _th_stored); \
  rb_thread_set_current(_th_stored); \
} while(0)

Definition at line 141 of file thread.c.

Referenced by rb_mutex_lock(), and ruby_kill().

#define mutex_mark   NULL

Definition at line 4185 of file thread.c.

#define OBJ_ID_EQL ( obj_id,
other   )     ((obj_id) == (other))

Referenced by recursive_check().

#define only_if_constant ( expr,
notconst   )     notconst

Definition at line 149 of file thread.c.

#define rb_fd_rcopy ( d,
 )     (*(d) = *(s))

Definition at line 3418 of file thread.c.

Referenced by rb_thread_select().

#define RB_GC_SAVE_MACHINE_CONTEXT ( th   ) 

Value:

do {                                                    \
        FLUSH_REGISTER_WINDOWS;                                 \
        RB_GC_SAVE_MACHINE_REGISTER_STACK(th);                  \
        setjmp((th)->machine.regs);                             \
        SET_MACHINE_STACK_END(&(th)->machine.stack_end);        \
    } while (0)

Definition at line 128 of file thread.c.

Referenced by blocking_region_begin(), and rb_thread_schedule_limits().

#define RB_GC_SAVE_MACHINE_REGISTER_STACK ( th   ) 

Definition at line 126 of file thread.c.

#define rb_intern ( str   )     rb_intern_const(str)

#define rb_thread_shield_waiting (  )     (int)((RBASIC(b)->flags&THREAD_SHIELD_WAITING_MASK)>>THREAD_SHIELD_WAITING_SHIFT)

Definition at line 4674 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_DEBUG   0

Definition at line 74 of file thread.c.

#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 4672 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 4673 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)

Definition at line 214 of file thread.c.

#define THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION

Definition at line 107 of file thread.c.

#define USE_NATIVE_THREAD_PRIORITY   0

Definition at line 68 of file thread.c.


Typedef Documentation

typedef struct rb_mutex_struct rb_mutex_t


Enumeration Type Documentation

enum handle_interrupt_timing

Enumerator:
INTERRUPT_NONE 
INTERRUPT_IMMEDIATE 
INTERRUPT_ON_BLOCKING 
INTERRUPT_NEVER 

Definition at line 1550 of file thread.c.


Function Documentation

static int blocking_region_begin ( rb_thread_t th,
struct rb_blocking_region_buffer region,
rb_unblock_function_t ubf,
void *  arg,
int  fail_if_interrupted 
) [inline, static]

Definition at line 1200 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().

static void blocking_region_end ( rb_thread_t th,
struct rb_blocking_region_buffer region 
) [inline, static]

Definition at line 1218 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 void* call_without_gvl ( void *(*)(void *)  func,
void *  data1,
rb_unblock_function_t ubf,
void *  data2,
int  fail_if_interrupted 
) [static]

Definition at line 1252 of file thread.c.

References BLOCKING_REGION, errno, func, GET_THREAD(), RUBY_UBF_IO, RUBY_UBF_PROCESS, RUBY_VM_CHECK_INTS_BLOCKING, and rb_thread_struct::waiting_fd.

Referenced by rb_thread_call_without_gvl(), and rb_thread_call_without_gvl2().

static int check_deadlock_i ( st_data_t  key,
st_data_t  val,
int *  found 
) [static]

Definition at line 5198 of file thread.c.

References rb_mutex_struct::cond_waiting, GetMutexPtr, GetThreadPtr, rb_mutex_struct::lock, rb_thread_struct::locking_mutex, RUBY_VM_INTERRUPTED, ST_CONTINUE, ST_STOP, rb_thread_struct::status, rb_mutex_struct::th, THREAD_STOPPED_FOREVER, and VALUE.

Referenced by rb_check_deadlock().

static void clear_coverage ( void   )  [static]

Definition at line 3891 of file thread.c.

References clear_coverage_i(), rb_get_coverages(), rb_hash_tbl_raw(), RTEST, st_foreach(), and VALUE.

Referenced by rb_thread_atfork_internal().

static int clear_coverage_i ( st_data_t  key,
st_data_t  val,
st_data_t  dummy 
) [static]

Definition at line 3877 of file thread.c.

References INT2FIX, Qnil, RARRAY_AREF, RARRAY_ASET, RARRAY_LEN, ST_CONTINUE, and VALUE.

Referenced by clear_coverage().

static int do_select ( int  n,
rb_fdset_t read,
rb_fdset_t write,
rb_fdset_t except,
struct timeval timeout 
) [static]

Definition at line 3422 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(), and rb_w32_select_with_thread().

static struct timeval double2timeval ( double  d  )  [static]

Definition at line 960 of file thread.c.

References timeval::tv_sec, timeval::tv_usec, and TYPEOF_TIMEVAL_TV_SEC.

Referenced by sleep_wait_for_interrupt().

static VALUE exec_recursive ( VALUE(*)(VALUE, VALUE, int)  func,
VALUE  obj,
VALUE  pairid,
VALUE  arg,
int  outer 
) [static]

Definition at line 4927 of file thread.c.

References exec_recursive_params::arg, exec_recursive_i(), EXEC_TAG, FALSE, exec_recursive_params::func, ID2SYM, JUMP_TAG, exec_recursive_params::list, exec_recursive_params::obj, exec_recursive_params::objid, exec_recursive_params::pairid, POP_TAG, PUSH_TAG, Qundef, rb_catch_protect(), rb_obj_id(), rb_throw_obj(), recursive_check(), recursive_list_access(), recursive_pop(), recursive_push(), and TRUE.

Referenced by rb_exec_recursive(), rb_exec_recursive_outer(), rb_exec_recursive_paired(), and rb_exec_recursive_paired_outer().

static VALUE exec_recursive_i ( RB_BLOCK_CALL_FUNC_ARGLIST(tag, data)   )  [static]

Definition at line 4909 of file thread.c.

References exec_recursive_params::arg, FALSE, exec_recursive_params::func, and exec_recursive_params::obj.

Referenced by exec_recursive().

static void getclockofday ( struct timeval tp  )  [static]

Definition at line 1011 of file thread.c.

References clock_gettime(), CLOCK_MONOTONIC, gettimeofday(), NULL, timespec::tv_nsec, timespec::tv_sec, timeval::tv_sec, and timeval::tv_usec.

Referenced by sleep_timeval().

static int handle_interrupt_arg_check_i ( VALUE  key,
VALUE  val 
) [static]

Definition at line 1672 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 VALUE ident_hash_new ( void   )  [static]

Definition at line 4759 of file thread.c.

References hash(), rb_hash_new(), rb_hash_tbl_raw(), st_table::type, and VALUE.

Referenced by recursive_list_access().

static rb_fdset_t* init_set_fd ( int  fd,
rb_fdset_t fds 
) [static]

Definition at line 3721 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 5069 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(), 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(), VALUE, and rb_thread_struct::vm.

static int keys_i ( VALUE  key,
VALUE  value,
VALUE  ary 
) [static]

Definition at line 3028 of file thread.c.

References rb_ary_push(), and ST_CONTINUE.

static int lock_func ( rb_thread_t th,
rb_mutex_t mutex,
int  timeout_ms 
) [static]

Definition at line 4309 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, and timespec::tv_sec.

Referenced by rb_mutex_lock().

static void lock_interrupt ( void *  ptr  )  [static]

Definition at line 4349 of file thread.c.

References rb_mutex_struct::cond, rb_mutex_struct::cond_waiting, and rb_mutex_struct::lock.

Referenced by rb_mutex_lock().

static VALUE mutex_alloc ( VALUE  klass  )  [static]

Definition at line 4227 of file thread.c.

References rb_mutex_struct::cond, rb_mutex_struct::lock, mutex_data_type, TypedData_Make_Struct, and VALUE.

Referenced by Init_Thread(), rb_mutex_new(), and thread_shield_alloc().

static void mutex_free ( void *  ptr  )  [static]

Definition at line 4188 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.

static VALUE mutex_initialize ( VALUE  self  )  [static]

Definition at line 4245 of file thread.c.

Referenced by Init_Thread().

static void mutex_locked ( rb_thread_t th,
VALUE  self 
) [static]

Definition at line 4271 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().

static size_t mutex_memsize ( const void *  ptr  )  [static]

Definition at line 4204 of file thread.c.

static VALUE mutex_sleep ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 4602 of file thread.c.

References rb_mutex_sleep(), rb_scan_args(), and VALUE.

Referenced by Init_Thread().

NOINLINE ( static int   thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start)  ) 

static void rb_check_deadlock ( rb_vm_t vm  )  [static]

Definition at line 5246 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(), VALUE, and vm_living_thread_num().

Referenced by rb_mutex_lock(), sleep_forever(), and thread_start_func_2().

VALUE rb_exec_recursive ( VALUE(*)(VALUE, VALUE, int)  func,
VALUE  obj,
VALUE  arg 
)

Definition at line 4982 of file thread.c.

References exec_recursive().

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().

VALUE rb_exec_recursive_outer ( VALUE(*)(VALUE, VALUE, int)  func,
VALUE  obj,
VALUE  arg 
)

Definition at line 5005 of file thread.c.

References exec_recursive().

Referenced by rb_hash().

VALUE rb_exec_recursive_paired ( VALUE(*)(VALUE, VALUE, int)  func,
VALUE  obj,
VALUE  paired_obj,
VALUE  arg 
)

Definition at line 4993 of file thread.c.

References exec_recursive(), 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 5017 of file thread.c.

References exec_recursive(), and rb_obj_id().

Referenced by cmp_eq().

void rb_gc_set_stack_end ( VALUE **  stack_end_p  ) 

Definition at line 3802 of file thread.c.

References VALUE.

VALUE rb_get_coverages ( void   ) 

Definition at line 5287 of file thread.c.

References GET_VM.

static void rb_mutex_abandon_all ( rb_mutex_t mutexes  )  [static]

Definition at line 4539 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 void rb_mutex_abandon_keeping_mutexes ( rb_thread_t th  )  [static]

Definition at line 4517 of file thread.c.

References rb_thread_struct::keeping_mutexes, NULL, and rb_mutex_abandon_all().

Referenced by terminate_atfork_i().

static void rb_mutex_abandon_locking_mutex ( rb_thread_t th  )  [static]

Definition at line 4526 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 4642 of file thread.c.

References rb_mutex_struct::allow_trap, and GetMutexPtr.

Referenced by io_binwrite().

VALUE rb_mutex_lock ( VALUE  self  ) 

Definition at line 4373 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().

VALUE rb_mutex_locked_p ( VALUE  self  ) 

Definition at line 4263 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 4251 of file thread.c.

References mutex_alloc(), and rb_cMutex.

Referenced by io_binwrite().

VALUE rb_mutex_owned_p ( VALUE  self  ) 

Definition at line 4449 of file thread.c.

References GET_THREAD(), GetMutexPtr, Qfalse, Qtrue, rb_mutex_struct::th, and VALUE.

Referenced by finish_writeconv(), Init_Thread(), and io_flush_buffer().

VALUE rb_mutex_sleep ( VALUE  self,
VALUE  timeout 
)

Definition at line 4567 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 VALUE.

Referenced by mutex_sleep().

static VALUE rb_mutex_sleep_forever ( VALUE  time  )  [static]

Definition at line 4552 of file thread.c.

References GET_THREAD(), Qnil, and sleep_forever().

Referenced by rb_mutex_sleep().

VALUE rb_mutex_synchronize ( VALUE  mutex,
VALUE(*)(VALUE arg)  func,
VALUE  arg 
)

Definition at line 4619 of file thread.c.

References rb_ensure(), rb_mutex_lock(), and rb_mutex_unlock().

Referenced by fptr_finalize(), io_binwrite(), io_flush_buffer(), and rb_mutex_synchronize_m().

static VALUE rb_mutex_synchronize_m ( VALUE  self,
VALUE  args 
) [static]

Definition at line 4633 of file thread.c.

References Qundef, rb_block_given_p(), rb_eThreadError, rb_mutex_synchronize(), rb_raise(), and rb_yield().

Referenced by Init_Thread().

VALUE rb_mutex_trylock ( VALUE  self  ) 

Definition at line 4290 of file thread.c.

References GET_THREAD(), GetMutexPtr, rb_mutex_struct::lock, mutex_locked(), Qfalse, Qtrue, rb_mutex_struct::th, and VALUE.

Referenced by Init_Thread(), and rb_mutex_lock().

VALUE rb_mutex_unlock ( VALUE  self  ) 

Definition at line 4504 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 const char * rb_mutex_unlock_th ( rb_mutex_t mutex,
rb_thread_t volatile *  th 
) [static]

Definition at line 4464 of file thread.c.

References rb_mutex_struct::cond, rb_mutex_struct::cond_waiting, err, 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().

static VALUE rb_mutex_wait_for ( VALUE  time  )  [static]

Definition at line 4559 of file thread.c.

References GET_THREAD(), Qnil, and sleep_timeval().

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().

VALUE rb_obj_is_mutex ( VALUE  obj  ) 

Definition at line 4216 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 5300 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 5293 of file thread.c.

References GET_VM, Qnil, rb_add_event_hook(), RUBY_EVENT_COVERAGE, and update_coverage().

Referenced by rb_coverage_start().

static VALUE rb_thread_abort_exc ( VALUE  thread  )  [static]

Definition at line 2521 of file thread.c.

References rb_thread_struct::abort_on_exception, GetThreadPtr, Qfalse, and Qtrue.

Referenced by Init_Thread().

static VALUE rb_thread_abort_exc_set ( VALUE  thread,
VALUE  val 
) [static]

Definition at line 2545 of file thread.c.

References rb_thread_struct::abort_on_exception, GetThreadPtr, and RTEST.

Referenced by Init_Thread().

static VALUE rb_thread_alive_p ( VALUE  thread  )  [static]

Definition at line 2668 of file thread.c.

References GetThreadPtr, Qfalse, Qtrue, and rb_threadptr_dead().

int rb_thread_alone ( void   ) 

Definition at line 2990 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().

static VALUE rb_thread_aref ( VALUE  thread,
VALUE  key 
) [static]

Definition at line 2829 of file thread.c.

References Qnil, rb_check_id(), and rb_thread_local_aref().

Referenced by Init_Thread().

static VALUE rb_thread_aset ( VALUE  self,
VALUE  id,
VALUE  val 
) [static]

Definition at line 2880 of file thread.c.

References rb_thread_local_aset(), and rb_to_id().

Referenced by Init_Thread().

void rb_thread_atfork ( void   ) 

Definition at line 3931 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 3954 of file thread.c.

References rb_thread_atfork_internal(), and terminate_atfork_before_exec_i().

static void rb_thread_atfork_internal ( int(*)(st_data_t, st_data_t, st_data_t atfork  )  [static]

Definition at line 3900 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(), VALUE, and rb_thread_struct::vm.

Referenced by rb_thread_atfork(), and rb_thread_atfork_before_exec().

static VALUE rb_thread_backtrace_locations_m ( int  argc,
VALUE *  argv,
VALUE  thval 
) [static]

Definition at line 5048 of file thread.c.

References rb_vm_thread_backtrace_locations().

Referenced by Init_Thread().

static VALUE rb_thread_backtrace_m ( int  argc,
VALUE *  argv,
VALUE  thval 
) [static]

Definition at line 5031 of file thread.c.

References 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 1413 of file thread.c.

References f, rb_thread_call_without_gvl(), and VALUE.

Referenced by rb_waitpid().

struct rb_blocking_region_buffer* rb_thread_blocking_region_begin ( void   ) 

Definition at line 1232 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 1241 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 1450 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 1373 of file thread.c.

References call_without_gvl(), and FALSE.

void* rb_thread_call_without_gvl2 ( void *(*)(void *)  func,
void *  data1,
rb_unblock_function_t ubf,
void *  data2 
)

Definition at line 1366 of file thread.c.

References call_without_gvl(), and TRUE.

Referenced by io_flush_buffer_async2(), and rb_write_internal2().

void rb_thread_check_ints ( void   ) 

Definition at line 1139 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 1149 of file thread.c.

References rb_signal_buff_size().

VALUE rb_thread_create ( VALUE(*)(ANYARGS)  fn,
void *  arg 
)

Definition at line 745 of file thread.c.

References rb_cThread, rb_thread_alloc(), thread_create_core(), and VALUE.

Referenced by lib_thread_callback(), lib_watchdog_core(), and rb_detach_process().

VALUE rb_thread_current ( void   ) 

Definition at line 2401 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(), 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(), recursive_pop(), thread_s_current(), tk_funcall(), VpGetException(), VpGetPrecLimit(), and VpGetRoundMode().

void rb_thread_execute_interrupts ( VALUE  thval  ) 

Definition at line 2026 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 VALUE rb_thread_exit ( void   )  [static]

Definition at line 2248 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 2131 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 3576 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().

int rb_thread_fd_writable ( int  fd  ) 

Definition at line 3525 of file thread.c.

References rb_thread_wait_fd_rw(), and TRUE.

Referenced by rb_io_wait_writable(), rsock_bsock_send(), and udp_send().

VALUE rb_thread_group ( VALUE  thread  ) 

Definition at line 2566 of file thread.c.

References GetThreadPtr, Qnil, rb_thread_struct::thgroup, and VALUE.

Referenced by Init_Thread().

static VALUE rb_thread_inspect ( VALUE  thread  )  [static]

Definition at line 2734 of file thread.c.

References GetThreadPtr, OBJ_INFECT, rb_obj_classname(), rb_sprintf(), thread_status_name(), and VALUE.

Referenced by Init_Thread().

int rb_thread_interrupted ( VALUE  thval  ) 

Definition at line 1156 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 1380 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, VALUE, 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().

static VALUE rb_thread_key_p ( VALUE  self,
VALUE  key 
) [static]

Definition at line 2960 of file thread.c.

References GetThreadPtr, rb_thread_struct::local_storage, Qfalse, Qtrue, rb_check_id(), and st_lookup().

Referenced by Init_Thread().

static VALUE rb_thread_keys ( VALUE  self  )  [static]

Definition at line 3015 of file thread.c.

References GetThreadPtr, rb_thread_struct::local_storage, rb_ary_new(), st_foreach(), thread_keys_i(), and VALUE.

Referenced by Init_Thread().

VALUE rb_thread_kill ( VALUE  thread  ) 

Definition at line 2187 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 2393 of file thread.c.

References GET_THREAD(), rb_ary_new(), st_foreach(), thread_list_i(), and VALUE.

Referenced by Init_Thread().

VALUE rb_thread_local_aref ( VALUE  thread,
ID  id 
)

Definition at line 2761 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().

VALUE rb_thread_local_aset ( VALUE  thread,
ID  id,
VALUE  val 
)

Definition at line 2854 of file thread.c.

References GetThreadPtr, OBJ_FROZEN, rb_error_frozen(), and threadptr_local_aset().

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 2422 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().

static VALUE rb_thread_pending_interrupt_p ( int  argc,
VALUE *  argv,
VALUE  target_thread 
) [static]

Definition at line 1839 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(), rb_threadptr_pending_interrupt_include_p(), and VALUE.

Referenced by Init_Thread(), and rb_thread_s_pending_interrupt_p().

void rb_thread_polling ( void   ) 

Definition at line 1122 of file thread.c.

References GET_THREAD(), rb_thread_alone(), RUBY_VM_CHECK_INTS_BLOCKING, and sleep_for_polling().

static VALUE rb_thread_priority ( VALUE  thread  )  [static]

Definition at line 3116 of file thread.c.

References GetThreadPtr, INT2NUM, and rb_thread_struct::priority.

Referenced by Init_Thread().

static VALUE rb_thread_priority_set ( VALUE  thread,
VALUE  prio 
) [static]

Definition at line 3151 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 3864 of file thread.c.

Referenced by after_exec_non_async_signal_safe().

VALUE rb_thread_run ( VALUE  thread  ) 

Definition at line 2318 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 VALUE rb_thread_s_abort_exc ( void   )  [static]

Definition at line 2462 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().

static VALUE rb_thread_s_abort_exc_set ( VALUE  self,
VALUE  val 
) [static]

Definition at line 2498 of file thread.c.

References GET_THREAD(), RTEST, rb_vm_struct::thread_abort_on_exception, and rb_thread_struct::vm.

Referenced by Init_Thread().

static VALUE rb_thread_s_handle_interrupt ( VALUE  self,
VALUE  mask_arg 
) [static]

Definition at line 1788 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, TH_PUSH_TAG, and VALUE.

Referenced by Init_Thread().

static VALUE rb_thread_s_kill ( VALUE  obj,
VALUE  th 
) [static]

Definition at line 2229 of file thread.c.

References rb_thread_kill().

Referenced by Init_Thread().

static VALUE rb_thread_s_main ( VALUE  klass  )  [static]

Definition at line 2435 of file thread.c.

References rb_thread_main().

Referenced by Init_Thread().

static VALUE rb_thread_s_pending_interrupt_p ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 1924 of file thread.c.

References GET_THREAD(), and rb_thread_pending_interrupt_p().

Referenced by Init_Thread().

static VALUE rb_thread_safe_level ( VALUE  thread  )  [static]

Definition at line 2718 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 1187 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 void rb_thread_schedule_limits ( unsigned long  limits_us  )  [static]

Definition at line 1170 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 3532 of file thread.c.

References NULL, rb_fd_copy, rb_fd_init, rb_fd_rcopy, rb_fd_term, and rb_thread_fd_select().

VALUE rb_thread_shield_destroy ( VALUE  self  ) 

Definition at line 4745 of file thread.c.

References DATA_PTR, GetThreadShieldPtr, Qfalse, Qtrue, rb_mutex_unlock(), rb_thread_shield_waiting, and VALUE.

Referenced by release_thread_shield().

VALUE rb_thread_shield_new ( void   ) 

Definition at line 4698 of file thread.c.

References DATA_PTR, rb_cThreadShield, rb_mutex_lock(), thread_shield_alloc(), and VALUE.

Referenced by load_lock().

VALUE rb_thread_shield_release ( VALUE  self  ) 

Definition at line 4734 of file thread.c.

References GetThreadShieldPtr, Qfalse, Qtrue, rb_mutex_unlock(), rb_thread_shield_waiting, and VALUE.

Referenced by release_thread_shield().

VALUE rb_thread_shield_wait ( VALUE  self  ) 

Definition at line 4714 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(), rb_mutex_struct::th, and VALUE.

Referenced by load_lock().

static void rb_thread_shield_waiting_dec ( VALUE  b  )  [inline, static]

Definition at line 4688 of file thread.c.

References rb_eRuntimeError, rb_raise(), rb_thread_shield_waiting, RBASIC, THREAD_SHIELD_WAITING_MASK, THREAD_SHIELD_WAITING_SHIFT, and VALUE.

Referenced by rb_thread_shield_wait().

static void rb_thread_shield_waiting_inc ( VALUE  b  )  [inline, static]

Definition at line 4677 of file thread.c.

References rb_eRuntimeError, rb_raise(), rb_thread_shield_waiting, RBASIC, THREAD_SHIELD_WAITING_MASK, THREAD_SHIELD_WAITING_SHIFT, and VALUE.

Referenced by rb_thread_shield_wait().

void rb_thread_sleep ( int  sec  ) 

Definition at line 1164 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 1076 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 1069 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 3870 of file thread.c.

References system_working.

Referenced by after_exec_non_async_signal_safe().

static VALUE rb_thread_status ( VALUE  thread  )  [static]

Definition at line 2637 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 2342 of file thread.c.

References Qnil, rb_eThreadError, rb_raise(), rb_thread_alone(), and rb_thread_sleep_deadly().

Referenced by Init_Thread().

static VALUE rb_thread_stop_p ( VALUE  thread  )  [static]

Definition at line 2693 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 3856 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().

static VALUE rb_thread_variable_get ( VALUE  thread,
VALUE  key 
) [static]

Definition at line 2914 of file thread.c.

References ID2SYM, id_locals, Qnil, rb_check_id(), rb_hash_aref(), rb_ivar_get(), and VALUE.

Referenced by Init_Thread().

static VALUE rb_thread_variable_p ( VALUE  thread,
VALUE  key 
) [static]

Definition at line 3081 of file thread.c.

References ID2SYM, id_locals, Qfalse, Qtrue, rb_check_id(), rb_ivar_get(), RHASH, st_lookup(), and VALUE.

Referenced by Init_Thread().

static VALUE rb_thread_variable_set ( VALUE  thread,
VALUE  id,
VALUE  val 
) [static]

Definition at line 2934 of file thread.c.

References ID2SYM, id_locals, OBJ_FROZEN, rb_error_frozen(), rb_hash_aset(), rb_ivar_get(), rb_to_id(), and VALUE.

Referenced by Init_Thread().

static VALUE rb_thread_variables ( VALUE  thread  )  [static]

Definition at line 3052 of file thread.c.

References id_locals, keys_i(), rb_ary_new(), rb_hash_foreach(), rb_ivar_get(), and VALUE.

Referenced by Init_Thread().

void rb_thread_wait_fd ( int  fd  ) 

Definition at line 3519 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 void rb_thread_wait_fd_rw ( int  fd,
int  read 
) [static]

Definition at line 3499 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 1115 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().

VALUE rb_thread_wakeup ( VALUE  thread  ) 

Definition at line 2272 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().

VALUE rb_thread_wakeup_alive ( VALUE  thread  ) 

Definition at line 2281 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 3815 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 int rb_threadptr_dead ( rb_thread_t th  )  [static]

Definition at line 2599 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 1953 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, VALUE, 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 void rb_threadptr_interrupt_common ( rb_thread_t th,
int  trap 
) [static]

Definition at line 341 of file thread.c.

References rb_thread_struct::interrupt_lock, RUBY_VM_SET_INTERRUPT, and RUBY_VM_SET_TRAP_INTERRUPT.

Referenced by rb_threadptr_interrupt(), and rb_threadptr_trap_interrupt().

int rb_threadptr_pending_interrupt_active_p ( rb_thread_t th  ) 

Definition at line 1653 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 enum handle_interrupt_timing rb_threadptr_pending_interrupt_check_mask ( rb_thread_t th,
VALUE  err 
) [static]

Definition at line 1558 of file thread.c.

References INTERRUPT_IMMEDIATE, 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, sym_on_blocking, and VALUE.

Referenced by rb_threadptr_pending_interrupt_deque().

void rb_threadptr_pending_interrupt_clear ( rb_thread_t th  ) 

Definition at line 1538 of file thread.c.

References rb_thread_struct::pending_interrupt_queue, and rb_ary_clear().

Referenced by rb_threadptr_to_kill().

static VALUE rb_threadptr_pending_interrupt_deque ( rb_thread_t th,
enum handle_interrupt_timing  timing 
) [static]

Definition at line 1616 of file thread.c.

References CLASS_OF, err, INTERRUPT_IMMEDIATE, 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(), rb_threadptr_pending_interrupt_empty_p(), and VALUE.

Referenced by rb_threadptr_execute_interrupts().

static int rb_threadptr_pending_interrupt_empty_p ( rb_thread_t th  )  [static]

Definition at line 1597 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 1544 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 int rb_threadptr_pending_interrupt_include_p ( rb_thread_t th,
VALUE  err 
) [static]

Definition at line 1603 of file thread.c.

References FALSE, rb_thread_struct::pending_interrupt_queue, RARRAY_AREF, RARRAY_LEN, rb_class_inherited_p(), TRUE, and VALUE.

Referenced by rb_thread_pending_interrupt_p().

static VALUE rb_threadptr_raise ( rb_thread_t ,
int  ,
VALUE *   
) [static]

Definition at line 2040 of file thread.c.

References Qnil, rb_eRuntimeError, rb_exc_new(), rb_make_exception(), rb_threadptr_dead(), rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), and VALUE.

Referenced by rb_check_deadlock(), rb_threadptr_signal_exit(), rb_threadptr_signal_raise(), thread_raise_m(), and thread_start_func_2().

static void rb_threadptr_ready ( rb_thread_t th  )  [static]

Definition at line 2034 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 2106 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 4794 of file thread.c.

References Qnil, threadptr_local_aref(), threadptr_local_aset(), and VALUE.

Referenced by rb_threadptr_exec_event_hooks_orig().

void rb_threadptr_restore_recursive_data ( rb_thread_t th,
VALUE  old 
)

Definition at line 4802 of file thread.c.

References threadptr_local_aset().

Referenced by rb_threadptr_exec_event_hooks_orig().

int rb_threadptr_set_raised ( rb_thread_t th  ) 

Definition at line 2096 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 2070 of file thread.c.

References argv, rb_vm_struct::main_thread, rb_eSystemExit, rb_str_new2, rb_threadptr_raise(), VALUE, and rb_thread_struct::vm.

Referenced by rb_signal_exec().

void rb_threadptr_signal_raise ( rb_thread_t th,
int  sig 
)

Definition at line 2060 of file thread.c.

References argv, INT2FIX, rb_vm_struct::main_thread, rb_eSignal, rb_threadptr_raise(), VALUE, and rb_thread_struct::vm.

Referenced by rb_signal_exec().

static void rb_threadptr_to_kill ( rb_thread_t th  )  [static]

Definition at line 1930 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().

VALUE rb_uninterruptible ( VALUE(*)(ANYARGS)  b_proc,
VALUE  data 
)

Definition at line 5307 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(), sym_never, and VALUE.

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 3775 of file thread.c.

References args, errno, init_set_fd(), NULL, rb_ensure(), RB_WAITFD_IN, RB_WAITFD_OUT, RB_WAITFD_PRI, select_single(), select_single_cleanup(), select_args::tv, and VALUE.

Referenced by io_wait_readable(), io_wait_writable(), rb_thread_wait_fd_rw(), and wait_connectable().

static VALUE recursive_check ( VALUE  list,
VALUE  obj_id,
VALUE  paired_obj_id 
) [static]

Definition at line 4814 of file thread.c.

References NIL_P, OBJ_ID_EQL, Qfalse, Qtrue, Qundef, rb_hash_lookup, rb_hash_lookup2(), RB_TYPE_P, T_HASH, and VALUE.

Referenced by exec_recursive().

static VALUE recursive_list_access ( void   )  [static]

Definition at line 4773 of file thread.c.

References hash(), ID2SYM, ident_hash_new(), list, NIL_P, Qnil, rb_frame_this_func(), rb_hash_aref(), rb_hash_aset(), rb_thread_current(), rb_thread_local_aref(), rb_thread_local_aset(), RB_TYPE_P, sym, T_HASH, and VALUE.

Referenced by exec_recursive().

static void recursive_pop ( VALUE  list,
VALUE  obj,
VALUE  paired_obj 
) [static]

Definition at line 4879 of file thread.c.

References ID2SYM, Qundef, rb_eTypeError, rb_frame_this_func(), rb_hash_delete(), rb_hash_lookup2(), rb_inspect(), rb_raise(), rb_thread_current(), RB_TYPE_P, RHASH_EMPTY_P, StringValuePtr, T_HASH, and VALUE.

Referenced by exec_recursive().

static void recursive_push ( VALUE  list,
VALUE  obj,
VALUE  paired_obj 
) [static]

Definition at line 4849 of file thread.c.

References Qtrue, Qundef, rb_hash_aset(), rb_hash_lookup2(), rb_hash_new(), RB_TYPE_P, T_HASH, and VALUE.

Referenced by exec_recursive().

static VALUE remove_from_join_list ( VALUE  arg  )  [static]

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 void reset_unblock_function ( rb_thread_t th,
const struct rb_unblock_callback old 
) [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 5319 of file thread.c.

References err, GET_THREAD(), GVL_UNLOCK_BEGIN, GVL_UNLOCK_END, rb_thread_struct::interrupt_cond, rb_thread_struct::interrupt_lock, kill(), and rb_sys_fail().

Referenced by rb_f_kill().

int ruby_native_thread_p ( void   ) 

Definition at line 5190 of file thread.c.

int ruby_thread_has_gvl_p ( void   ) 

Definition at line 1492 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 2084 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.

static VALUE select_single ( VALUE  ptr  )  [static]

Definition at line 3741 of file thread.c.

References args, errno, rb_fd_isset, rb_thread_fd_select(), RB_WAITFD_IN, RB_WAITFD_OUT, RB_WAITFD_PRI, and VALUE.

Referenced by rb_wait_for_single_fd().

static VALUE select_single_cleanup ( VALUE  ptr  )  [static]

Definition at line 3763 of file thread.c.

References args, rb_fd_term, and VALUE.

Referenced by rb_wait_for_single_fd().

static int set_unblock_function ( rb_thread_t th,
rb_unblock_function_t func,
void *  arg,
struct rb_unblock_callback old,
int  fail_if_interrupted 
) [static]

Definition at line 304 of file thread.c.

References rb_unblock_callback::arg, FALSE, 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 void sleep_for_polling ( rb_thread_t th  )  [static]

Definition at line 1106 of file thread.c.

References sleep_timeval(), timeval::tv_sec, and timeval::tv_usec.

Referenced by rb_thread_polling().

static void sleep_forever ( rb_thread_t th,
int  nodeadlock,
int  spurious_check 
) [static]

Definition at line 987 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 void sleep_timeval ( rb_thread_t th,
struct timeval  time,
int  spurious_check 
) [static]

Definition at line 1027 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 void sleep_wait_for_interrupt ( rb_thread_t th,
double  sleepsec,
int  spurious_check 
) [static]

Definition at line 1100 of file thread.c.

References double2timeval(), and sleep_timeval().

Referenced by thread_join_sleep().

static void st_delete_wrap ( st_table table,
st_data_t  key 
) [inline, static]

Definition at line 100 of file thread.c.

References st_delete().

Referenced by thread_start_func_2(), and threadptr_local_aset().

static int terminate_atfork_before_exec_i ( st_data_t  key,
st_data_t  val,
st_data_t  current_th 
) [static]

Definition at line 3941 of file thread.c.

References GetThreadPtr, ST_CONTINUE, thread_cleanup_func_before_exec(), and VALUE.

Referenced by rb_thread_atfork_before_exec().

static int terminate_atfork_i ( st_data_t  key,
st_data_t  val,
st_data_t  current_th 
) [static]

Definition at line 3916 of file thread.c.

References GetThreadPtr, rb_mutex_abandon_keeping_mutexes(), rb_mutex_abandon_locking_mutex(), ST_CONTINUE, thread_cleanup_func(), TRUE, and VALUE.

Referenced by rb_thread_atfork().

static int terminate_i ( st_data_t  key,
st_data_t  val,
rb_thread_t main_thread 
) [static]

Definition at line 371 of file thread.c.

References eTerminateSignal, GetThreadPtr, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), ST_CONTINUE, thread_debug, and VALUE.

Referenced by rb_thread_terminate_all().

static VALUE thgroup_add ( VALUE  group,
VALUE  thread 
) [static]

Definition at line 4124 of file thread.c.

References thgroup::enclosed, GetThreadPtr, OBJ_FROZEN, Qnil, rb_eThreadError, rb_raise(), rb_thread_struct::thgroup, thgroup_data_type, and TypedData_Get_Struct.

Referenced by Init_Thread().

static VALUE thgroup_enclose ( VALUE  group  )  [static]

Definition at line 4067 of file thread.c.

References thgroup::enclosed, thgroup_data_type, and TypedData_Get_Struct.

Referenced by Init_Thread().

static VALUE thgroup_enclosed_p ( VALUE  group  )  [static]

Definition at line 4086 of file thread.c.

References thgroup::enclosed, Qfalse, Qtrue, thgroup_data_type, and TypedData_Get_Struct.

Referenced by Init_Thread().

static VALUE thgroup_list ( VALUE  group  )  [static]

Definition at line 4038 of file thread.c.

References thgroup_list_params::ary, GET_THREAD(), thgroup_list_params::group, rb_ary_new(), st_data_t, st_foreach(), thgroup_list_i(), and VALUE.

Referenced by Init_Thread().

static int thgroup_list_i ( st_data_t  key,
st_data_t  val,
st_data_t  data 
) [static]

Definition at line 4014 of file thread.c.

References GetThreadPtr, thgroup_list_params::group, rb_ary_push(), ST_CONTINUE, rb_thread_struct::thgroup, and VALUE.

Referenced by thgroup_list().

static size_t thgroup_memsize ( const void *  ptr  )  [static]

Definition at line 3965 of file thread.c.

static VALUE thgroup_s_alloc ( VALUE  klass  )  [static]

Definition at line 3996 of file thread.c.

References thgroup::enclosed, thgroup::group, thgroup_data_type, TypedData_Make_Struct, and VALUE.

Referenced by Init_Thread().

static void thread_cleanup_func ( void *  th_ptr,
int  atfork 
) [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().

static void thread_cleanup_func_before_exec ( void *  th_ptr  )  [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().

static VALUE thread_create_core ( VALUE  thval,
VALUE  args,
VALUE(*)(ANYARGS)  fn 
) [static]

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().

static int thread_fd_close_i ( st_data_t  key,
st_data_t  val,
st_data_t  data 
) [static]

Definition at line 2116 of file thread.c.

References err, GetThreadPtr, rb_threadptr_interrupt(), rb_threadptr_pending_interrupt_enque(), ruby_error_closed_stream, rb_vm_struct::special_exceptions, ST_CONTINUE, VALUE, rb_thread_struct::vm, and rb_thread_struct::waiting_fd.

Referenced by rb_thread_fd_close().

static VALUE thread_initialize ( VALUE  thread,
VALUE  args 
) [static]

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, thread_create_core(), and VALUE.

Referenced by Init_Thread().

static VALUE thread_join ( rb_thread_t target_th,
double  delay 
) [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(), VALUE, and join_arg::waiting.

Referenced by thread_join_m(), and thread_value().

static VALUE thread_join_m ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 899 of file thread.c.

References DELAY_INFTY, GetThreadPtr, join_arg::limit, NIL_P, rb_num2dbl(), rb_scan_args(), thread_join(), and VALUE.

Referenced by Init_Thread().

static VALUE thread_join_sleep ( VALUE  arg  )  [static]

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().

static int thread_keys_i ( ID  key,
VALUE  value,
VALUE  ary 
) [static]

Definition at line 2977 of file thread.c.

References ID2SYM, rb_ary_push(), and ST_CONTINUE.

Referenced by rb_thread_keys().

static int thread_list_i ( st_data_t  key,
st_data_t  val,
void *  data 
) [static]

Definition at line 2353 of file thread.c.

References GetThreadPtr, rb_ary_push(), rb_thread_struct::self, ST_CONTINUE, rb_thread_struct::status, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, and VALUE.

Referenced by rb_thread_list().

static VALUE thread_raise_m ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 2158 of file thread.c.

References GET_THREAD(), GetThreadPtr, Qnil, rb_threadptr_raise(), and RUBY_VM_CHECK_INTS.

Referenced by Init_Thread().

static VALUE thread_s_current ( VALUE  klass  )  [static]

Definition at line 2416 of file thread.c.

References rb_thread_current().

Referenced by Init_Thread().

static VALUE thread_s_new ( int  argc,
VALUE *  argv,
VALUE  klass 
) [static]

Definition at line 685 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(), rb_mutex_struct::th, THREAD_KILLED, and VALUE.

Referenced by Init_Thread().

static VALUE thread_s_pass ( VALUE  klass  )  [static]

Definition at line 1513 of file thread.c.

References Qnil, and rb_thread_schedule().

Referenced by Init_Thread().

static VALUE thread_shield_alloc ( VALUE  klass  )  [static]

Definition at line 4666 of file thread.c.

References mutex_alloc(), thread_shield_data_type, and TypedData_Wrap_Struct.

Referenced by rb_thread_shield_new().

static void thread_shield_mark ( void *  ptr  )  [static]

Definition at line 4654 of file thread.c.

References rb_gc_mark(), and VALUE.

static VALUE thread_start ( VALUE  klass,
VALUE  args 
) [static]

Definition at line 713 of file thread.c.

References rb_thread_alloc(), and thread_create_core().

Referenced by Init_Thread().

static int thread_start_func_2 ( rb_thread_t th,
VALUE *  stack_start,
VALUE *  register_stack_start 
) [static]

Definition at line 503 of file thread.c.

References rb_proc_t::block, rb_block_struct::ep, EXEC_EVENT_HOOK, EXEC_TAG, rb_thread_struct::first_args, GetProcPtr, rb_thread_struct::machine, rb_vm_struct::main_thread, rb_thread_list_struct::next, PRIxVALUE, Qfalse, Qnil, Qundef, RARRAY_CONST_PTR, RARRAY_LEN, 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(), RTEST, ruby_debug, RUBY_EVENT_THREAD_BEGIN, RUBY_EVENT_THREAD_END, ruby_stop(), SAVE_ROOT_JMPBUF, st_delete_wrap(), rb_thread_struct::stack_start, rb_thread_struct::status, T_OBJECT, TAG_FATAL, rb_thread_list_struct::th, rb_mutex_struct::th, TH_POP_TAG, TH_PUSH_TAG, thread_debug, THREAD_KILLED, THREAD_RUNNABLE, THREAD_STOPPED, THREAD_STOPPED_FOREVER, VALUE, and rb_thread_struct::vm.

static const char* thread_status_name ( rb_thread_t th  )  [static]

Definition at line 2580 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().

static VALUE thread_value ( VALUE  self  )  [static]

Definition at line 926 of file thread.c.

References DELAY_INFTY, GetThreadPtr, thread_join(), and rb_thread_struct::value.

Referenced by Init_Thread().

static rb_atomic_t threadptr_get_interrupts ( rb_thread_t th  )  [inline, static]

Definition at line 1940 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 VALUE threadptr_local_aref ( rb_thread_t th,
ID  id 
) [static]

Definition at line 2750 of file thread.c.

References rb_thread_struct::local_storage, Qnil, st_data_t, st_lookup(), and VALUE.

Referenced by rb_thread_local_aref(), and rb_threadptr_reset_recursive_data().

static VALUE threadptr_local_aset ( rb_thread_t th,
ID  id,
VALUE  val 
) [static]

Definition at line 2837 of file thread.c.

References rb_thread_struct::local_storage, NIL_P, Qnil, st_delete_wrap(), st_init_numtable(), and st_insert().

Referenced by rb_thread_local_aset(), rb_threadptr_reset_recursive_data(), and rb_threadptr_restore_recursive_data().

static double timeofday ( void   )  [static]

Definition at line 1083 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 void timer_thread_function ( void *   )  [static]

Definition at line 3825 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 void update_coverage ( rb_event_flag_t  event,
VALUE  proc,
VALUE  self,
ID  id,
VALUE  klass 
) [static]

Definition at line 5270 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(), RBASIC, and VALUE.

Referenced by rb_reset_coverages(), and rb_set_coverages().

static int vm_living_thread_num ( rb_vm_t vm  )  [static]

Definition at line 2984 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().


Variable Documentation

ID id_locals [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().

const rb_data_type_t mutex_data_type [static]

Initial value:

Definition at line 4209 of file thread.c.

Referenced by mutex_alloc(), and rb_obj_is_mutex().

const rb_thread_t* patrol_thread = NULL [static]

Definition at line 4363 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().

ID recursive_key [static]

Definition at line 4754 of file thread.c.

struct st_hash_type st_hashtype_num

VALUE sym_immediate [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().

VALUE sym_never [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().

VALUE sym_on_blocking [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().

volatile int system_working = 1 [static]

Definition at line 95 of file thread.c.

Referenced by rb_thread_start_timer_thread().

const rb_data_type_t thgroup_data_type [static]

Initial value:

Definition at line 3970 of file thread.c.

Referenced by thgroup_add(), thgroup_enclose(), thgroup_enclosed_p(), and thgroup_s_alloc().

const rb_data_type_t thread_shield_data_type [static]

Initial value:

 {
    "thread_shield",
    {thread_shield_mark, 0, 0,},
    NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
}

Definition at line 4659 of file thread.c.

Referenced by thread_shield_alloc().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7