14#ifdef THREAD_SYSTEM_DEPENDENT_IMPLEMENTATION
18#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
19# include "wasm/machine.h"
22#define TIME_QUANTUM_MSEC (100)
23#define TIME_QUANTUM_USEC (TIME_QUANTUM_MSEC * 1000)
24#define TIME_QUANTUM_NSEC (TIME_QUANTUM_USEC * 1000)
115ruby_thread_from_native(
void)
117 return ruby_native_thread;
124 rb_ractor_set_current_ec(th->ractor, th->ec);
126 ruby_native_thread = th;
134 ruby_thread_set_native(main_th);
150#if defined(__wasm__) && !defined(__EMSCRIPTEN__)
151 th->ec->machine.stack_start = (
VALUE *)rb_wasm_stack_get_base();
159 th->status = THREAD_KILLED;
160 rb_ractor_living_threads_remove(th->ractor, th);
165#define register_ubf_list(th) (void)(th)
166#define unregister_ubf_list(th) (void)(th)
170ubf_wakeup_all_threads(
void)
176ubf_threads_empty(
void)
187ubf_timer_disarm(
void)
193#define TIMER_THREAD_CREATED_P() (1)
195rb_thread_create_timer_thread(
void)
200rb_thread_wakeup_timer_thread(
int sig)
205native_stop_timer_thread(
void)
211native_reset_timer_thread(
void)
222native_set_another_thread_name(rb_nativethread_id_t thread_id,
VALUE name)
227#define USE_NATIVE_THREAD_NATIVE_THREAD_ID 0
251NORETURN(
void rb_sigwait_fd_put(
rb_thread_t *,
int));
255 rb_bug(
"not implemented, should not be called rb_sigwait_fd_put");
258NORETURN(
void rb_sigwait_sleep(
const rb_thread_t *,
int,
const rb_hrtime_t *));
260rb_sigwait_sleep(
const rb_thread_t *th,
int sigwait_fd,
const rb_hrtime_t *rel)
262 rb_bug(
"not implemented, should not be called rb_sigwait_sleep");
270 (void)clock_nanosleep(CLOCK_REALTIME, 0, rb_hrtime2timespec(&ts, rel), NULL);
276 return rb_fd_select(n, readfds, writefds, exceptfds, timeout);
280rb_thread_start_unblock_thread(
void)
#define Qfalse
Old name of RUBY_Qfalse.
void ruby_init_stack(volatile VALUE *addr)
Set stack bottom of Ruby implementation.
void rb_notimplement(void)
void rb_bug(const char *fmt,...)
Interpreter panic switch.
int rb_reserved_fd_p(int fd)
Queries if the given FD is reserved or not.
#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.