1#ifndef INTERNAL_THREAD_H
2#define INTERNAL_THREAD_H
13#include "ccan/list/list.h"
18#define RB_VM_SAVE_MACHINE_CONTEXT(th) \
20 FLUSH_REGISTER_WINDOWS; \
21 setjmp((th)->ec->machine.regs); \
22 SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
26#define COVERAGE_INDEX_LINES 0
27#define COVERAGE_INDEX_BRANCHES 1
28#define COVERAGE_TARGET_LINES 1
29#define COVERAGE_TARGET_BRANCHES 2
30#define COVERAGE_TARGET_METHODS 4
31#define COVERAGE_TARGET_ONESHOT_LINES 8
32#define COVERAGE_TARGET_EVAL 16
34#define RUBY_FATAL_THREAD_KILLED INT2FIX(0)
35#define RUBY_FATAL_THREAD_TERMINATED INT2FIX(1)
36#define RUBY_FATAL_FIBER_KILLED RB_INT2FIX(2)
40void rb_thread_execute_interrupts(
VALUE th);
41VALUE rb_get_coverages(
void);
42int rb_get_coverage_mode(
void);
43VALUE rb_default_coverage(
int);
44VALUE rb_thread_shield_new(
void);
49int rb_thread_to_be_killed(
VALUE thread);
50void rb_thread_acquire_fork_lock(
void);
51void rb_thread_release_fork_lock(
void);
52void rb_thread_reset_fork_lock(
void);
53void rb_mutex_allow_trap(
VALUE self,
int val);
57void ruby_mn_threads_params(
void);
60int rb_thread_wait_for_single_fd(
int fd,
int events,
struct timeval *
timeout);
62size_t rb_thread_io_close_interrupt(
struct rb_io *);
63void rb_thread_io_close_wait(
struct rb_io *);
67RUBY_SYMBOL_EXPORT_BEGIN
69void *rb_thread_prevent_fork(
void *(*func)(
void *),
void *data);
72VALUE rb_thread_io_blocking_region(
struct rb_io *io, rb_blocking_function_t *func,
void *data1);
73VALUE rb_thread_io_blocking_call(
struct rb_io *io, rb_blocking_function_t *func,
void *data1,
int events);
79int ruby_thread_has_gvl_p(
void);
83int rb_threadptr_execute_interrupts(
struct rb_thread_struct *th,
int blocking_timing);
84bool rb_thread_mn_schedulable(
VALUE thread);
90typedef VALUE (rb_interrupt_exec_func_t)(
void *data);
92enum rb_interrupt_exec_flag {
93 rb_interrupt_exec_flag_none = 0x00,
94 rb_interrupt_exec_flag_value_data = 0x01,
95 rb_interrupt_exec_flag_new_thread = 0x02,
102 rb_interrupt_exec_func_t *func,
void *data,
enum rb_interrupt_exec_flag flags);
106 rb_interrupt_exec_func_t *func,
void *data,
enum rb_interrupt_exec_flag flags);
void rb_unblock_function_t(void *)
This is the type of UBFs.
Ruby's IO, metadata and buffers.
VALUE self
The IO's Ruby level counterpart.
VALUE timeout
The timeout associated with this IO when performing blocking operations.
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
uintptr_t VALUE
Type that represents a Ruby object.