1#ifndef INTERNAL_THREAD_H
2#define INTERNAL_THREAD_H
13#include "ccan/list/list.h"
19#define RB_VM_SAVE_MACHINE_CONTEXT(th) \
21 FLUSH_REGISTER_WINDOWS; \
22 setjmp((th)->ec->machine.regs); \
23 SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
26#define RUBY_FATAL_THREAD_KILLED INT2FIX(0)
27#define RUBY_FATAL_THREAD_TERMINATED INT2FIX(1)
28#define RUBY_FATAL_FIBER_KILLED RB_INT2FIX(2)
32void rb_thread_execute_interrupts(
VALUE th);
33VALUE rb_thread_shield_new(
void);
38int rb_thread_to_be_killed(
VALUE thread);
39void rb_thread_acquire_fork_lock(
void);
40void rb_thread_release_fork_lock(
void);
41void rb_thread_reset_fork_lock(
void);
42void rb_mutex_allow_trap(
VALUE self,
int val);
46void ruby_mn_threads_params(
void);
51size_t rb_thread_io_close_interrupt(
struct rb_io *);
52void rb_thread_io_close_wait(
struct rb_io *);
56void rb_thread_free_native_thread(
void *th_ptr);
58bool rb_thread_event_hooks_registered_p(
void);
59void rb_thread_free_body(
void *th);
61RUBY_SYMBOL_EXPORT_BEGIN
63void *rb_thread_prevent_fork(
void *(*func)(
void *),
void *data);
66VALUE rb_thread_io_blocking_region(
struct rb_io *io, rb_blocking_function_t *func,
void *data1);
67VALUE rb_thread_io_blocking_call(
struct rb_io *io, rb_blocking_function_t *func,
void *data1,
int events);
73int ruby_thread_has_gvl_p(
void);
77int rb_threadptr_execute_interrupts(
struct rb_thread_struct *th,
int blocking_timing);
78bool rb_thread_mn_schedulable(
VALUE thread);
84typedef VALUE (rb_interrupt_exec_func_t)(
void *data);
86enum rb_interrupt_exec_flag {
87 rb_interrupt_exec_flag_none = 0x00,
88 rb_interrupt_exec_flag_value_data = 0x01,
89 rb_interrupt_exec_flag_new_thread = 0x02,
96 rb_interrupt_exec_func_t *func,
void *data,
enum rb_interrupt_exec_flag flags);
100 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.