14#ifdef THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
18#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
19# include "wasm/machine.h"
33#define thread_sched_to_dead(a,b) thread_sched_to_waiting(a,b,true)
111ruby_thread_from_native(
void)
113 return ruby_native_thread;
120 rb_ractor_set_current_ec(th->ractor, th->ec);
122 ruby_native_thread = th;
130 ruby_thread_set_native(main_th);
134ruby_mn_threads_params(
void)
145native_thread_init_stack(
rb_thread_t *th,
void *local_in_parent_frame)
147#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
148 th->ec->machine.stack_start = (
VALUE *)rb_wasm_stack_get_base();
156 th->status = THREAD_KILLED;
157 rb_ractor_living_threads_remove(th->ractor, th);
162#define register_ubf_list(th) (void)(th)
163#define unregister_ubf_list(th) (void)(th)
167ubf_wakeup_all_threads(
void)
173ubf_threads_empty(
void)
184ubf_timer_disarm(
void)
190#define TIMER_THREAD_CREATED_P() (1)
192rb_thread_create_timer_thread(
void)
197rb_thread_wakeup_timer_thread(
int sig)
202native_stop_timer_thread(
void)
208native_reset_timer_thread(
void)
219native_set_another_thread_name(rb_nativethread_id_t thread_id,
VALUE name)
224#define USE_NATIVE_THREAD_NATIVE_THREAD_ID 0
248NORETURN(
void rb_sigwait_fd_put(
rb_thread_t *,
int));
252 rb_bug(
"not implemented, should not be called rb_sigwait_fd_put");
255NORETURN(
void rb_sigwait_sleep(
const rb_thread_t *,
int,
const rb_hrtime_t *));
257rb_sigwait_sleep(
const rb_thread_t *th,
int sigwait_fd,
const rb_hrtime_t *rel)
259 rb_bug(
"not implemented, should not be called rb_sigwait_sleep");
267 (void)clock_nanosleep(CLOCK_REALTIME, 0, rb_hrtime2timespec(&ts, rel), NULL);
273 return rb_fd_select(n, readfds, writefds, exceptfds, timeout);
322 rb_bug(
"unreachable");
340rb_thread_prevent_fork(
void *(*func)(
void *),
void *data)
346rb_thread_malloc_stack_set(
rb_thread_t *th,
void *stack,
size_t stack_size)
352rb_thread_event_hooks_registered_p(
void)
360rb_thread_sched_winding_begin(
rb_vm_t *vm)
367rb_thread_sched_winding_end(
rb_vm_t *vm)
373rb_thread_sched_wait_winding(
rb_vm_t *vm)
int rb_reserved_fd_p(int fd)
Queries if the given FD is reserved or not.
void rb_unblock_function_t(void *)
This is the type of UBFs.
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.