1#ifndef INTERNAL_THREAD_H
2#define INTERNAL_THREAD_H
13#include "ccan/list/list.h"
20#define RB_VM_SAVE_MACHINE_CONTEXT(th) \
22 FLUSH_REGISTER_WINDOWS; \
23 setjmp((th)->ec->machine.regs); \
24 SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
27#define RUBY_FATAL_THREAD_KILLED INT2FIX(0)
28#define RUBY_FATAL_THREAD_TERMINATED INT2FIX(1)
29#define RUBY_FATAL_FIBER_KILLED RB_INT2FIX(2)
33void rb_thread_execute_interrupts(
VALUE th);
34VALUE rb_thread_shield_new(
void);
39int rb_thread_to_be_killed(
VALUE thread);
40void rb_thread_acquire_fork_lock(
void);
41void rb_thread_release_fork_lock(
void);
42void rb_thread_reset_fork_lock(
void);
43void rb_mutex_allow_trap(
VALUE self,
int val);
47void ruby_mn_threads_params(
void);
52size_t rb_thread_io_close_interrupt(
struct rb_io *);
53void rb_thread_io_close_wait(
struct rb_io *);
57void rb_thread_free_native_thread(
void *th_ptr);
59bool rb_thread_event_hooks_registered_p(
void);
60void rb_thread_free_body(
void *th);
62RUBY_SYMBOL_EXPORT_BEGIN
64void *rb_thread_prevent_fork(
void *(*func)(
void *),
void *data);
65void rb_thread_register_exiting(
void);
68VALUE rb_thread_io_blocking_region(
struct rb_io *io, rb_blocking_function_t *func,
void *data1);
69VALUE rb_thread_io_blocking_call(
struct rb_io *io, rb_blocking_function_t *func,
void *data1,
int events);
75int ruby_thread_has_gvl_p(
void);
79int rb_threadptr_execute_interrupts(
struct rb_thread_struct *th,
int blocking_timing);
80bool rb_thread_mn_schedulable(
VALUE thread);
86typedef VALUE (rb_interrupt_exec_func_t)(
void *data);
88enum rb_interrupt_exec_flag {
89 rb_interrupt_exec_flag_none = 0x00,
90 rb_interrupt_exec_flag_value_data = 0x01,
91 rb_interrupt_exec_flag_new_thread = 0x02,
98 rb_interrupt_exec_func_t *func,
void *data,
enum rb_interrupt_exec_flag flags);
102 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.