14#ifdef THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
18#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
19# include "wasm/machine.h"
33#define thread_sched_to_dead thread_sched_to_waiting
113ruby_thread_from_native(
void)
115 return ruby_native_thread;
122 rb_ractor_set_current_ec(th->ractor, th->ec);
124 ruby_native_thread = th;
132 ruby_thread_set_native(main_th);
136ruby_mn_threads_params(
void)
141native_thread_init_stack(
rb_thread_t *th,
void *local_in_parent_frame)
143#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
144 th->ec->machine.stack_start = (
VALUE *)rb_wasm_stack_get_base();
152 th->status = THREAD_KILLED;
153 rb_ractor_living_threads_remove(th->ractor, th);
158#define register_ubf_list(th) (void)(th)
159#define unregister_ubf_list(th) (void)(th)
163ubf_wakeup_all_threads(
void)
169ubf_threads_empty(
void)
180ubf_timer_disarm(
void)
186#define TIMER_THREAD_CREATED_P() (1)
188rb_thread_create_timer_thread(
void)
193rb_thread_wakeup_timer_thread(
int sig)
198native_stop_timer_thread(
void)
204native_reset_timer_thread(
void)
215native_set_another_thread_name(rb_nativethread_id_t thread_id,
VALUE name)
220#define USE_NATIVE_THREAD_NATIVE_THREAD_ID 0
244NORETURN(
void rb_sigwait_fd_put(
rb_thread_t *,
int));
248 rb_bug(
"not implemented, should not be called rb_sigwait_fd_put");
251NORETURN(
void rb_sigwait_sleep(
const rb_thread_t *,
int,
const rb_hrtime_t *));
253rb_sigwait_sleep(
const rb_thread_t *th,
int sigwait_fd,
const rb_hrtime_t *rel)
255 rb_bug(
"not implemented, should not be called rb_sigwait_sleep");
263 (void)clock_nanosleep(CLOCK_REALTIME, 0, rb_hrtime2timespec(&ts, rel), NULL);
269 return rb_fd_select(n, readfds, writefds, exceptfds, timeout);
314rb_thread_sched_mark_zombies(
rb_vm_t *vm)
326rb_thread_prevent_fork(
void *(*func)(
void *),
void *data)
void rb_notimplement(void)
int rb_reserved_fd_p(int fd)
Queries if the given FD is reserved or not.
bool rb_thread_lock_native_thread(void)
Declare the current Ruby thread should acquire a dedicated native thread on M:N thread scheduler.
#define rb_fd_select
Waits for multiple file descriptors at once.
The data structure which wraps the fd_set bitmap used by select(2).
rb_nativethread_id_t rb_nativethread_self(void)
Queries the ID of the native thread that is calling this function.
void rb_native_mutex_lock(rb_nativethread_lock_t *lock)
Just another name of rb_nativethread_lock_lock.
void rb_native_cond_initialize(rb_nativethread_cond_t *cond)
Fills the passed condition variable with an initial value.
int rb_native_mutex_trylock(rb_nativethread_lock_t *lock)
Identical to rb_native_mutex_lock(), except it doesn't block in case rb_native_mutex_lock() would.
void rb_native_cond_broadcast(rb_nativethread_cond_t *cond)
Signals a condition variable.
void rb_native_mutex_initialize(rb_nativethread_lock_t *lock)
Just another name of rb_nativethread_lock_initialize.
void rb_native_mutex_unlock(rb_nativethread_lock_t *lock)
Just another name of rb_nativethread_lock_unlock.
void rb_native_mutex_destroy(rb_nativethread_lock_t *lock)
Just another name of rb_nativethread_lock_destroy.
void rb_native_cond_destroy(rb_nativethread_cond_t *cond)
Destroys the passed condition variable.
void rb_native_cond_signal(rb_nativethread_cond_t *cond)
Signals a condition variable.
void rb_native_cond_wait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex)
Waits for the passed condition variable to be signalled.
void rb_native_cond_timedwait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec)
Identical to rb_native_cond_wait(), except it additionally takes timeout in msec resolution.
uintptr_t VALUE
Type that represents a Ruby object.