Ruby 1.9.3p327(2012-11-10revision37606)
Data Structures | Defines | Typedefs | Enumerations | Functions | Variables
thread.c File Reference
#include "eval_intern.h"
#include "gc.h"
#include "internal.h"
#include "ruby/io.h"
Include dependency graph for thread.c:

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
struct  event_call_args

Defines

#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_CONTEXT(th)
#define GVL_UNLOCK_BEGIN()
#define GVL_UNLOCK_END()
#define blocking_region_begin(th, region, func, arg)
#define BLOCKING_REGION(exec, ubf, ubfarg)
#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 THREAD_IO_WAITING_P(th)
#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 GetBarrierPtr(obj)   ((VALUE)rb_check_typeddata((obj), &barrier_data_type))
#define RUBY_EVENT_REMOVED   0x1000000
#define rb_intern(str)   rb_intern_const(str)

Typedefs

typedef struct rb_mutex_struct rb_mutex_t

Enumerations

enum  {
  EVENT_RUNNING_NOTHING, EVENT_RUNNING_TRACE = 1, EVENT_RUNNING_THREAD = 2, EVENT_RUNNING_VM = 4,
  EVENT_RUNNING_EVENT_MASK = EVENT_RUNNING_VM|EVENT_RUNNING_THREAD
}

Functions

static void sleep_timeval (rb_thread_t *th, struct timeval time)
static void sleep_wait_for_interrupt (rb_thread_t *th, double sleepsec)
static void sleep_forever (rb_thread_t *th, int nodeadlock)
static double timeofday (void)
static int rb_threadptr_dead (rb_thread_t *th)
static void rb_check_deadlock (rb_vm_t *vm)
static void st_delete_wrap (st_table *table, st_data_t key)
static void set_unblock_function (rb_thread_t *th, rb_unblock_function_t *func, void *arg, struct rb_unblock_callback *old)
static void reset_unblock_function (rb_thread_t *th, const struct rb_unblock_callback *old)
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_thread_lock_unlock (rb_thread_lock_t *lock)
void rb_thread_lock_destroy (rb_thread_lock_t *lock)
void rb_threadptr_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 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)
static 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_threadptr_execute_interrupts_common (rb_thread_t *)
static void rb_thread_schedule_limits (unsigned long limits_us)
void rb_thread_schedule (void)
struct rb_blocking_region_bufferrb_thread_blocking_region_begin (void)
void rb_thread_blocking_region_end (struct rb_blocking_region_buffer *region)
VALUE rb_thread_blocking_region (rb_blocking_function_t *func, 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_call_without_gvl (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_execute_interrupts (rb_thread_t *th)
void rb_thread_execute_interrupts (VALUE thval)
void rb_gc_mark_threads (void)
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 (enum rb_thread_status status)
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)
VALUE rb_thread_local_aref (VALUE thread, ID id)
static VALUE rb_thread_aref (VALUE thread, VALUE id)
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_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 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_gc_save_machine_context (rb_thread_t *th)
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_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 void barrier_mark (void *ptr)
static VALUE barrier_alloc (VALUE klass)
VALUE rb_barrier_new (void)
VALUE rb_barrier_wait (VALUE self)
VALUE rb_barrier_release (VALUE self)
VALUE rb_barrier_destroy (VALUE self)
static VALUE recursive_list_access (void)
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 (VALUE tag, struct exec_recursive_params *p)
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)
static VALUE thread_suppress_tracing (rb_thread_t *th, int ev, VALUE(*func)(VALUE, int), VALUE arg, int always)
static rb_event_hook_talloc_event_hook (rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
static void thread_reset_event_flags (rb_thread_t *th)
static void rb_threadptr_add_event_hook (rb_thread_t *th, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
static rb_thread_tthval2thread_t (VALUE thval)
void rb_thread_add_event_hook (VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
static int set_threads_event_flags_i (st_data_t key, st_data_t val, st_data_t flag)
static void set_threads_event_flags (int flag)
static int exec_event_hooks (const rb_event_hook_t *hook, rb_event_flag_t flag, VALUE self, ID id, VALUE klass)
static int remove_defered_event_hook (rb_event_hook_t **root)
static VALUE thread_exec_event_hooks (VALUE args, int running)
void rb_threadptr_exec_event_hooks (rb_thread_t *th, rb_event_flag_t flag, VALUE self, ID id, VALUE klass)
void rb_add_event_hook (rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
static int defer_remove_event_hook (rb_event_hook_t *hook, rb_event_hook_func_t func)
static int remove_event_hook (rb_event_hook_t **root, rb_event_hook_func_t func)
static int rb_threadptr_remove_event_hook (rb_thread_t *th, rb_event_hook_func_t func)
int rb_thread_remove_event_hook (VALUE thval, rb_event_hook_func_t func)
static rb_event_hook_tsearch_live_hook (rb_event_hook_t *hook)
static int running_vm_event_hooks (st_data_t key, st_data_t val, st_data_t data)
static rb_thread_tvm_event_hooks_running_thread (rb_vm_t *vm)
int rb_remove_event_hook (rb_event_hook_func_t func)
static int clear_trace_func_i (st_data_t key, st_data_t val, st_data_t flag)
void rb_clear_trace_func (void)
static void call_trace_func (rb_event_flag_t, VALUE data, VALUE self, ID id, VALUE klass)
static VALUE set_trace_func (VALUE obj, VALUE trace)
static void thread_add_trace_func (rb_thread_t *th, VALUE trace)
static VALUE thread_add_trace_func_m (VALUE obj, VALUE trace)
static VALUE thread_set_trace_func_m (VALUE obj, VALUE trace)
static const char * get_event_name (rb_event_flag_t event)
static VALUE call_trace_proc (VALUE args, int tracing)
VALUE ruby_suppress_tracing (VALUE(*func)(VALUE, int), VALUE arg, int always)
static VALUE rb_thread_backtrace_m (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)

Variables

VALUE rb_cMutex
VALUE rb_cBarrier
static volatile int system_working = 1
static const rb_data_type_t thgroup_data_type
static const rb_data_type_t mutex_data_type
rb_thread_tpatrol_thread = NULL
static const rb_data_type_t barrier_data_type
static ID recursive_key

Define Documentation

#define BLOCKING_REGION (   exec,
  ubf,
  ubfarg 
)
Value:
do { \
    rb_thread_t *__th = GET_THREAD(); \
    struct rb_blocking_region_buffer __region; \
    blocking_region_begin(__th, &__region, (ubf), (ubfarg)); \
    exec; \
    blocking_region_end(__th, &__region); \
    RUBY_VM_CHECK_INTS(); \
} while(0)

Definition at line 127 of file thread.c.

Referenced by do_select(), rb_thread_blocking_region(), and rb_thread_io_blocking_region().

#define blocking_region_begin (   th,
  region,
  func,
  arg 
)
Value:
do { \
    (region)->prev_status = (th)->status; \
    set_unblock_function((th), (func), (arg), &(region)->oldubf); \
    (th)->blocking_region_buffer = (region); \
    (th)->status = THREAD_STOPPED; \
    thread_debug("enter blocking region (%p)\n", (void *)(th)); \
    RB_GC_SAVE_MACHINE_CONTEXT(th); \
    gvl_release((th)->vm); \
  } while (0)

Definition at line 116 of file thread.c.

Referenced by rb_thread_blocking_region_begin(), and rb_thread_call_with_gvl().

#define closed_stream_error   GET_VM()->special_exceptions[ruby_error_closed_stream]

Definition at line 77 of file thread.c.

Referenced by Init_Thread().

#define DELAY_INFTY   1E30

Definition at line 650 of file thread.c.

Referenced by thread_join(), thread_join_m(), and thread_value().

#define eKillSignal   INT2FIX(0)

Definition at line 73 of file thread.c.

Referenced by rb_thread_kill(), and rb_threadptr_execute_interrupts_common().

#define eTerminateSignal   INT2FIX(1)

Definition at line 74 of file thread.c.

Referenced by rb_threadptr_execute_interrupts_common(), and terminate_i().

#define GetBarrierPtr (   obj)    ((VALUE)rb_check_typeddata((obj), &barrier_data_type))

Definition at line 3778 of file thread.c.

Referenced by rb_barrier_destroy(), rb_barrier_release(), and rb_barrier_wait().

#define GetMutexPtr (   obj,
  tobj 
)    TypedData_Get_Struct((obj), rb_mutex_t, &mutex_data_type, (tobj))
#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 106 of file thread.c.

Referenced by rb_mutex_lock().

#define GVL_UNLOCK_END ( )
Value:
gvl_acquire(_th_stored->vm, _th_stored); \
  rb_thread_set_current(_th_stored); \
} while(0)

Definition at line 111 of file thread.c.

Referenced by rb_mutex_lock().

#define mutex_mark   NULL

Definition at line 3362 of file thread.c.

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

Definition at line 2515 of file thread.c.

Referenced by rb_thread_select().

#define RB_GC_SAVE_MACHINE_CONTEXT (   th)
Value:
do { \
    rb_gc_save_machine_context(th); \
    SET_MACHINE_STACK_END(&(th)->machine_stack_end); \
  } while (0)

Definition at line 100 of file thread.c.

Referenced by rb_thread_schedule_limits().

#define rb_intern (   str)    rb_intern_const(str)
#define RUBY_EVENT_REMOVED   0x1000000
#define RUBY_THREAD_PRIORITY_MAX   3

Definition at line 54 of file thread.c.

Referenced by rb_thread_priority_set().

#define RUBY_THREAD_PRIORITY_MIN   -3

Definition at line 55 of file thread.c.

Referenced by rb_thread_priority_set().

#define thread_debug   if(0)printf
#define THREAD_DEBUG   0

Definition at line 59 of file thread.c.

#define THREAD_IO_WAITING_P (   th)
Value:
(                       \
        ((th)->status == THREAD_STOPPED ||              \
         (th)->status == THREAD_STOPPED_FOREVER) &&     \
        (th)->blocking_region_buffer &&                 \
        (th)->unblock.func == ubf_select &&             \
        1)

Definition at line 1437 of file thread.c.

Referenced by thread_fd_close_i().

#define thread_start_func_2 (   th,
  st,
  rst 
)    thread_start_func_2(th, st)

Definition at line 188 of file thread.c.

#define THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION

Definition at line 87 of file thread.c.

#define USE_NATIVE_THREAD_PRIORITY   0

Definition at line 53 of file thread.c.


Typedef Documentation

typedef struct rb_mutex_struct rb_mutex_t

Enumeration Type Documentation

anonymous enum
Enumerator:
EVENT_RUNNING_NOTHING 
EVENT_RUNNING_TRACE 
EVENT_RUNNING_THREAD 
EVENT_RUNNING_VM 
EVENT_RUNNING_EVENT_MASK 

Definition at line 4048 of file thread.c.


Function Documentation

static rb_event_hook_t* alloc_event_hook ( rb_event_hook_func_t  func,
rb_event_flag_t  events,
VALUE  data 
) [static]
static VALUE barrier_alloc ( VALUE  klass) [static]

Definition at line 3773 of file thread.c.

References mutex_alloc(), and TypedData_Wrap_Struct.

Referenced by rb_barrier_new().

static void barrier_mark ( void *  ptr) [static]

Definition at line 3762 of file thread.c.

References rb_gc_mark().

static void blocking_region_end ( rb_thread_t th,
struct rb_blocking_region_buffer region 
) [inline, static]
static void call_trace_func ( rb_event_flag_t  event,
VALUE  data,
VALUE  self,
ID  id,
VALUE  klass 
) [static]
static VALUE call_trace_proc ( VALUE  args,
int  tracing 
) [static]
static int check_deadlock_i ( st_data_t  key,
st_data_t  val,
int *  found 
) [static]
static void clear_coverage ( void  ) [static]

Definition at line 3067 of file thread.c.

References clear_coverage_i(), rb_get_coverages(), RHASH_TBL, RTEST, and st_foreach().

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

References INT2FIX, Qnil, RARRAY_LEN, RARRAY_PTR, and ST_CONTINUE.

Referenced by clear_coverage().

static int clear_trace_func_i ( st_data_t  key,
st_data_t  val,
st_data_t  flag 
) [static]
static int defer_remove_event_hook ( rb_event_hook_t hook,
rb_event_hook_func_t  func 
) [static]
static int do_select ( int  n,
rb_fdset_t read,
rb_fdset_t write,
rb_fdset_t except,
struct timeval timeout 
) [static]
static struct timeval double2timeval ( double  d) [static, read]

Definition at line 830 of file thread.c.

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

Referenced by sleep_wait_for_interrupt().

static int exec_event_hooks ( const rb_event_hook_t hook,
rb_event_flag_t  flag,
VALUE  self,
ID  id,
VALUE  klass 
) [inline, static]
static VALUE exec_recursive ( VALUE(*)(VALUE, VALUE, int)  func,
VALUE  obj,
VALUE  pairid,
VALUE  arg,
int  outer 
) [static]
static VALUE exec_recursive_i ( VALUE  tag,
struct exec_recursive_params p 
) [static]
static const char* get_event_name ( rb_event_flag_t  event) [static]
static void getclockofday ( struct timeval tp) [static]

Definition at line 865 of file thread.c.

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

Referenced by sleep_timeval().

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

Definition at line 2896 of file thread.c.

References rb_fd_init, and rb_fd_set.

Referenced by rb_wait_for_single_fd().

void Init_Thread ( void  )
static int lock_func ( rb_thread_t th,
rb_mutex_t mutex,
int  timeout_ms 
) [static]
static void lock_interrupt ( void *  ptr) [static]

Definition at line 3525 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]
static void mutex_free ( void *  ptr) [static]
static VALUE mutex_initialize ( VALUE  self) [static]

Definition at line 3421 of file thread.c.

Referenced by Init_Thread().

static void mutex_locked ( rb_thread_t th,
VALUE  self 
) [static]
static size_t mutex_memsize ( const void *  ptr) [static]

Definition at line 3381 of file thread.c.

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

Definition at line 3735 of file thread.c.

References rb_mutex_sleep(), and rb_scan_args().

Referenced by Init_Thread().

NOINLINE ( static int   thread_start_func_2rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_start)
void rb_add_event_hook ( rb_event_hook_func_t  func,
rb_event_flag_t  events,
VALUE  data 
)
VALUE rb_barrier_destroy ( VALUE  self)

Definition at line 3810 of file thread.c.

References DATA_PTR, GetBarrierPtr, and rb_mutex_unlock().

Referenced by load_unlock().

VALUE rb_barrier_new ( void  )

Definition at line 3781 of file thread.c.

References barrier_alloc(), DATA_PTR, rb_cBarrier, and rb_mutex_lock().

Referenced by load_lock().

VALUE rb_barrier_release ( VALUE  self)

Definition at line 3804 of file thread.c.

References GetBarrierPtr, and rb_mutex_unlock().

Referenced by load_unlock().

VALUE rb_barrier_wait ( VALUE  self)
static void rb_check_deadlock ( rb_vm_t vm) [static]
void rb_clear_trace_func ( void  )

Definition at line 4350 of file thread.c.

References clear_trace_func_i(), GET_VM, rb_remove_event_hook(), and st_foreach().

Referenced by ruby_finalize_0(), and ruby_options().

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

Definition at line 4040 of file thread.c.

References exec_recursive(), and func.

Referenced by range_hash(), rb_ary_hash(), rb_hash_hash(), and rb_struct_hash().

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

Definition at line 1347 of file thread.c.

References rb_bug().

void rb_gc_save_machine_context ( rb_thread_t th)

Definition at line 2985 of file thread.c.

References FLUSH_REGISTER_WINDOWS, and rb_thread_struct::machine_regs.

void rb_gc_set_stack_end ( VALUE **  stack_end_p)

Definition at line 2977 of file thread.c.

VALUE rb_get_coverages ( void  )

Definition at line 4831 of file thread.c.

References GET_VM.

Referenced by clear_coverage(), coverage(), prepare_iseq_build(), rb_coverage_result(), and rb_coverage_start().

static void rb_mutex_abandon_all ( rb_mutex_t mutexes) [static]

Definition at line 3678 of file thread.c.

References rb_mutex_struct::next_mutex, and rb_mutex_struct::th.

Referenced by terminate_atfork_i().

VALUE rb_mutex_lock ( VALUE  self)
VALUE rb_mutex_locked_p ( VALUE  self)

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

References mutex_alloc(), and rb_cMutex.

Referenced by io_binwrite().

VALUE rb_mutex_sleep ( VALUE  self,
VALUE  timeout 
)
static VALUE rb_mutex_sleep_forever ( VALUE  time) [static]

Definition at line 3691 of file thread.c.

References Qnil, and rb_thread_sleep_deadly().

Referenced by rb_mutex_sleep().

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

Definition at line 3752 of file thread.c.

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

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

VALUE rb_mutex_trylock ( VALUE  self)
VALUE rb_mutex_unlock ( VALUE  self)
static const char * rb_mutex_unlock_th ( rb_mutex_t mutex,
rb_thread_t volatile *  th 
) [static]
static VALUE rb_mutex_wait_for ( VALUE  time) [static]

Definition at line 3698 of file thread.c.

References Qnil, and rb_thread_wait_for().

Referenced by rb_mutex_sleep().

VALUE rb_obj_is_mutex ( VALUE  obj)

Definition at line 3392 of file thread.c.

References Qfalse, Qtrue, and rb_typeddata_is_kind_of().

Referenced by rb_objspace_call_finalizer().

int rb_remove_event_hook ( rb_event_hook_func_t  func)
void rb_reset_coverages ( void  )

Definition at line 4844 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 4837 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 1829 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 1847 of file thread.c.

References rb_thread_struct::abort_on_exception, GetThreadPtr, rb_secure(), and RTEST.

Referenced by Init_Thread().

void rb_thread_add_event_hook ( VALUE  thval,
rb_event_hook_func_t  func,
rb_event_flag_t  events,
VALUE  data 
)

Definition at line 4110 of file thread.c.

References rb_threadptr_add_event_hook(), and thval2thread_t().

static VALUE rb_thread_alive_p ( VALUE  thread) [static]
int rb_thread_alone ( void  )
static VALUE rb_thread_aref ( VALUE  thread,
VALUE  id 
) [static]

Definition at line 2082 of file thread.c.

References rb_thread_local_aref(), and rb_to_id().

Referenced by Init_Thread().

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

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

References GET_THREAD, 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 3132 of file thread.c.

References rb_thread_atfork_internal(), and terminate_atfork_before_exec_i().

Referenced by chfunc().

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

Definition at line 4603 of file thread.c.

References rb_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 
)
struct rb_blocking_region_buffer* rb_thread_blocking_region_begin ( void  ) [read]

Definition at line 1059 of file thread.c.

References ALLOC, blocking_region_begin, and GET_THREAD.

void rb_thread_blocking_region_end ( struct rb_blocking_region_buffer region)

Definition at line 1068 of file thread.c.

References blocking_region_end(), errno, GET_THREAD, RUBY_VM_CHECK_INTS, and xfree().

void* rb_thread_call_with_gvl ( void *(*)(void *)  func,
void *  data1 
)
VALUE rb_thread_call_without_gvl ( rb_blocking_function_t func,
void *  data1,
rb_unblock_function_t ubf,
void *  data2 
)

Definition at line 1159 of file thread.c.

References rb_thread_blocking_region().

void rb_thread_check_ints ( void  )

Definition at line 983 of file thread.c.

References RUBY_VM_CHECK_INTS.

Referenced by bigmul1_normal(), collect_all(), lib_eventloop_core(), and trap_check().

int rb_thread_check_trap_pending ( void  )

Definition at line 993 of file thread.c.

References rb_signal_buff_size().

Referenced by ip_rbTkWaitCommand(), ip_rbUpdateCommand(), ip_rbVwaitCommand(), and trap_check().

VALUE rb_thread_create ( VALUE(*)(ANYARGS)  fn,
void *  arg 
)
VALUE rb_thread_current ( void  )
void rb_thread_execute_interrupts ( VALUE  thval)
static VALUE rb_thread_exit ( void  ) [static]

Definition at line 1571 of file thread.c.

References GET_THREAD, and rb_thread_kill().

Referenced by Init_Thread().

void rb_thread_fd_close ( int  fd)

Definition at line 1464 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 
)
int rb_thread_fd_writable ( int  fd)
VALUE rb_thread_group ( VALUE  thread)

Definition at line 1869 of file thread.c.

References GetThreadPtr, Qnil, and rb_thread_struct::thgroup.

Referenced by Init_Thread().

static VALUE rb_thread_inspect ( VALUE  thread) [static]
int rb_thread_interrupted ( VALUE  thval)

Definition at line 1000 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 
)
static VALUE rb_thread_key_p ( VALUE  self,
VALUE  key 
) [static]

Definition at line 2138 of file thread.c.

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

Referenced by Init_Thread().

static VALUE rb_thread_keys ( VALUE  self) [static]

Definition at line 2193 of file thread.c.

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

Referenced by Init_Thread().

VALUE rb_thread_kill ( VALUE  thread)
VALUE rb_thread_list ( void  )

Definition at line 1719 of file thread.c.

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

Referenced by Init_Thread().

VALUE rb_thread_local_aref ( VALUE  thread,
ID  id 
)
VALUE rb_thread_local_aset ( VALUE  thread,
ID  id,
VALUE  val 
)
void rb_thread_lock_destroy ( rb_thread_lock_t lock)

Definition at line 259 of file thread.c.

void rb_thread_lock_unlock ( rb_thread_lock_t lock)

Definition at line 253 of file thread.c.

VALUE rb_thread_main ( void  )

Definition at line 1748 of file thread.c.

References GET_THREAD.

Referenced by rb_thread_s_main().

void rb_thread_polling ( void  )

Definition at line 966 of file thread.c.

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

Referenced by rb_f_kill(), and rb_file_flock().

static VALUE rb_thread_priority ( VALUE  thread) [static]

Definition at line 2221 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]
int rb_thread_remove_event_hook ( VALUE  thval,
rb_event_hook_func_t  func 
)

Definition at line 4286 of file thread.c.

References rb_threadptr_remove_event_hook(), and thval2thread_t().

void rb_thread_reset_timer_thread ( void  )

Definition at line 3040 of file thread.c.

Referenced by after_exec().

VALUE rb_thread_run ( VALUE  thread)
static VALUE rb_thread_s_abort_exc ( void  ) [static]

Definition at line 1780 of file thread.c.

References GET_THREAD, Qfalse, and Qtrue.

Referenced by Init_Thread().

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

Definition at line 1811 of file thread.c.

References GET_THREAD, rb_secure(), and RTEST.

Referenced by Init_Thread().

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

Definition at line 1554 of file thread.c.

References rb_thread_kill().

Referenced by Init_Thread().

static VALUE rb_thread_s_main ( VALUE  klass) [static]

Definition at line 1761 of file thread.c.

References rb_thread_main().

Referenced by Init_Thread().

static VALUE rb_thread_safe_level ( VALUE  thread) [static]

Definition at line 2007 of file thread.c.

References GetThreadPtr, INT2NUM(), and rb_thread_struct::safe_level.

Referenced by Init_Thread().

void rb_thread_schedule ( void  )
static void rb_thread_schedule_limits ( unsigned long  limits_us) [static]
int rb_thread_select ( int  max,
fd_set *  read,
fd_set *  write,
fd_set *  except,
struct timeval timeout 
)

Definition at line 2710 of file thread.c.

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

Referenced by old_thread_select().

void rb_thread_sleep ( int  sec)

Definition at line 1008 of file thread.c.

References INT2FIX, rb_thread_wait_for(), and rb_time_timeval().

Referenced by pipe_open().

static void rb_thread_sleep_deadly ( void  ) [static]

Definition at line 920 of file thread.c.

References GET_THREAD, sleep_forever(), and thread_debug.

Referenced by rb_mutex_sleep_forever(), and rb_thread_stop().

void rb_thread_sleep_forever ( void  )

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

References system_working.

Referenced by after_exec().

static VALUE rb_thread_status ( VALUE  thread) [static]
VALUE rb_thread_stop ( void  )

Definition at line 1667 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]
void rb_thread_stop_timer_thread ( int  close_anyway)

Definition at line 3032 of file thread.c.

Referenced by before_exec(), and ruby_cleanup().

void rb_thread_terminate_all ( void  )
void rb_thread_wait_fd ( int  fd)
static void rb_thread_wait_fd_rw ( int  fd,
int  read 
) [static]
void rb_thread_wait_for ( struct timeval  time)
VALUE rb_thread_wakeup ( VALUE  thread)
VALUE rb_thread_wakeup_alive ( VALUE  thread)
static void rb_threadptr_add_event_hook ( rb_thread_t th,
rb_event_hook_func_t  func,
rb_event_flag_t  events,
VALUE  data 
) [static]
void rb_threadptr_check_signal ( rb_thread_t mth)

Definition at line 2999 of file thread.c.

References rb_signal_buff_size(), and rb_threadptr_interrupt().

Referenced by ruby_cleanup(), and timer_thread_function().

static int rb_threadptr_dead ( rb_thread_t th) [static]
void rb_threadptr_exec_event_hooks ( rb_thread_t th,
rb_event_flag_t  flag,
VALUE  self,
ID  id,
VALUE  klass 
)
void rb_threadptr_execute_interrupts ( rb_thread_t th)

Definition at line 1333 of file thread.c.

References rb_threadptr_execute_interrupts_common().

static void rb_threadptr_execute_interrupts_common ( rb_thread_t th) [static]
void rb_threadptr_interrupt ( rb_thread_t th)
static VALUE rb_threadptr_raise ( rb_thread_t th,
int  argc,
VALUE argv 
) [static]
static void rb_threadptr_ready ( rb_thread_t th) [static]

Definition at line 1355 of file thread.c.

References rb_threadptr_interrupt().

Referenced by rb_thread_wakeup_alive(), and rb_threadptr_raise().

static int rb_threadptr_remove_event_hook ( rb_thread_t th,
rb_event_hook_func_t  func 
) [static]
int rb_threadptr_reset_raised ( rb_thread_t th)
int rb_threadptr_set_raised ( rb_thread_t th)
void rb_threadptr_signal_exit ( rb_thread_t th)
void rb_threadptr_signal_raise ( rb_thread_t th,
int  sig 
)
void rb_threadptr_unlock_all_locking_mutexes ( rb_thread_t th)
void rb_vm_gvl_destroy ( rb_vm_t vm)

Definition at line 246 of file thread.c.

Referenced by ruby_vm_destruct().

int rb_wait_for_single_fd ( int  fd,
int  events,
struct timeval tv 
)
static VALUE recursive_check ( VALUE  list,
VALUE  obj_id,
VALUE  paired_obj_id 
) [static]

Definition at line 3856 of file thread.c.

References NIL_P, Qfalse, Qtrue, Qundef, rb_hash_lookup, rb_hash_lookup2(), T_HASH, and TYPE.

Referenced by exec_recursive().

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

Definition at line 3884 of file thread.c.

References OBJ_UNTRUST, Qtrue, Qundef, rb_hash_aset(), rb_hash_lookup2(), rb_hash_new(), T_HASH, and TYPE.

Referenced by exec_recursive(), and exec_recursive_i().

static int remove_defered_event_hook ( rb_event_hook_t **  root) [static]
static int remove_event_hook ( rb_event_hook_t **  root,
rb_event_hook_func_t  func 
) [static]
static VALUE remove_from_join_list ( VALUE  arg) [static]
static void reset_unblock_function ( rb_thread_t th,
const struct rb_unblock_callback old 
) [static]

Definition at line 284 of file thread.c.

References rb_thread_struct::interrupt_lock, and rb_thread_struct::unblock.

Referenced by blocking_region_end(), and rb_mutex_lock().

int ruby_native_thread_p ( void  )

Definition at line 4734 of file thread.c.

VALUE ruby_suppress_tracing ( VALUE(*)(VALUE, int)  func,
VALUE  arg,
int  always 
)

Definition at line 4551 of file thread.c.

References EVENT_RUNNING_TRACE, func, GET_THREAD, and thread_suppress_tracing().

Referenced by call_trace_func(), and yycompile().

int ruby_thread_has_gvl_p ( void  )
void ruby_thread_init_stack ( rb_thread_t th)

Definition at line 418 of file thread.c.

Referenced by Init_BareVM().

void ruby_thread_stack_overflow ( rb_thread_t th)
static int running_vm_event_hooks ( st_data_t  key,
st_data_t  val,
st_data_t  data 
) [static]
static rb_event_hook_t* search_live_hook ( rb_event_hook_t hook) [static]
static VALUE select_single ( VALUE  ptr) [static]
static VALUE select_single_cleanup ( VALUE  ptr) [static]

Definition at line 2938 of file thread.c.

References select_args::except, rb_fd_term, select_args::read, and select_args::write.

Referenced by rb_wait_for_single_fd().

static void set_threads_event_flags ( int  flag) [static]

Definition at line 4133 of file thread.c.

References GET_VM, set_threads_event_flags_i(), and st_foreach().

Referenced by rb_add_event_hook(), and rb_remove_event_hook().

static int set_threads_event_flags_i ( st_data_t  key,
st_data_t  val,
st_data_t  flag 
) [static]

Definition at line 4117 of file thread.c.

References rb_thread_struct::event_flags, GetThreadPtr, key, RUBY_EVENT_VM, and ST_CONTINUE.

Referenced by set_threads_event_flags().

static VALUE set_trace_func ( VALUE  obj,
VALUE  trace 
) [static]
static void set_unblock_function ( rb_thread_t th,
rb_unblock_function_t func,
void *  arg,
struct rb_unblock_callback old 
) [static]
static void sleep_for_polling ( rb_thread_t th) [static]

Definition at line 950 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 
) [static]
static void sleep_timeval ( rb_thread_t th,
struct timeval  time 
) [static]
static void sleep_wait_for_interrupt ( rb_thread_t th,
double  sleepsec 
) [static]

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

References st_delete().

Referenced by rb_thread_local_aset(), thread_create_core(), and thread_start_func_2().

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

Definition at line 3119 of file thread.c.

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

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]
static int terminate_i ( st_data_t  key,
st_data_t  val,
rb_thread_t main_thread 
) [static]
static VALUE thgroup_add ( VALUE  group,
VALUE  thread 
) [static]
static VALUE thgroup_enclose ( VALUE  group) [static]

Definition at line 3240 of file thread.c.

References thgroup::enclosed, thgroup::group, thgroup_data_type, and TypedData_Get_Struct.

Referenced by Init_Thread().

static VALUE thgroup_enclosed_p ( VALUE  group) [static]

Definition at line 3260 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]
static int thgroup_list_i ( st_data_t  key,
st_data_t  val,
st_data_t  data 
) [static]
static size_t thgroup_memsize ( const void *  ptr) [static]

Definition at line 3143 of file thread.c.

static VALUE thgroup_s_alloc ( VALUE  klass) [static]

Definition at line 3166 of file thread.c.

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

Referenced by Init_Thread().

static void thread_add_trace_func ( rb_thread_t th,
VALUE  trace 
) [static]
static VALUE thread_add_trace_func_m ( VALUE  obj,
VALUE  trace 
) [static]

Definition at line 4438 of file thread.c.

References GetThreadPtr, event_call_args::th, and thread_add_trace_func().

Referenced by Init_Thread().

static void thread_cleanup_func ( void *  th_ptr,
int  atfork 
) [static]
static void thread_cleanup_func_before_exec ( void *  th_ptr) [static]
static VALUE thread_create_core ( VALUE  thval,
VALUE  args,
VALUE(*)(ANYARGS)  fn 
) [static]
static VALUE thread_exec_event_hooks ( VALUE  args,
int  running 
) [static]
static int thread_fd_close_i ( st_data_t  key,
st_data_t  val,
st_data_t  data 
) [static]
static VALUE thread_initialize ( VALUE  thread,
VALUE  args 
) [static]
static VALUE thread_join ( rb_thread_t target_th,
double  delay 
) [static]
static VALUE thread_join_m ( int  argc,
VALUE argv,
VALUE  self 
) [static]

Definition at line 789 of file thread.c.

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

Referenced by Init_Thread().

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

Definition at line 2155 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]
static VALUE thread_raise_m ( int  argc,
VALUE argv,
VALUE  self 
) [static]

Definition at line 1491 of file thread.c.

References GetThreadPtr, Qnil, and rb_threadptr_raise().

Referenced by Init_Thread().

static void thread_reset_event_flags ( rb_thread_t th) [static]
static VALUE thread_s_current ( VALUE  klass) [static]

Definition at line 1742 of file thread.c.

References rb_thread_current().

Referenced by Init_Thread().

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

Definition at line 1262 of file thread.c.

References Qnil, and rb_thread_schedule().

Referenced by Init_Thread().

static VALUE thread_set_trace_func_m ( VALUE  obj,
VALUE  trace 
) [static]
static VALUE thread_start ( VALUE  klass,
VALUE  args 
) [static]

Definition at line 611 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]
static const char* thread_status_name ( enum rb_thread_status  status) [static]
static VALUE thread_suppress_tracing ( rb_thread_t th,
int  ev,
VALUE(*)(VALUE, int)  func,
VALUE  arg,
int  always 
) [static]
static VALUE thread_value ( VALUE  self) [static]

Definition at line 817 of file thread.c.

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

Referenced by Init_Thread().

static rb_thread_t* thval2thread_t ( VALUE  thval) [static]
static double timeofday ( void  ) [static]
static void timer_thread_function ( void *  arg) [static]
static void update_coverage ( rb_event_flag_t  event,
VALUE  proc,
VALUE  self,
ID  id,
VALUE  klass 
) [static]
static rb_thread_t* vm_event_hooks_running_thread ( rb_vm_t vm) [static]

Definition at line 4312 of file thread.c.

References rb_vm_struct::living_threads, NULL, running_vm_event_hooks(), and st_foreach().

Referenced by rb_remove_event_hook().

static int vm_living_thread_num ( rb_vm_t vm) [static]

Variable Documentation

Initial value:
 {
    "barrier",
    {barrier_mark, 0, 0,},
}

Definition at line 3767 of file thread.c.

Initial value:
 {
    "mutex",
    {mutex_mark, mutex_free, mutex_memsize,},
}

Definition at line 3386 of file thread.c.

Definition at line 3539 of file thread.c.

Definition at line 63 of file thread.c.

Referenced by rb_barrier_new().

Definition at line 62 of file thread.c.

Referenced by Init_Thread(), and rb_mutex_new().

ID recursive_key [static]

Definition at line 3818 of file thread.c.

volatile int system_working = 1 [static]

Definition at line 75 of file thread.c.

Referenced by rb_thread_start_timer_thread().

Initial value:

Definition at line 3148 of file thread.c.

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