1 #ifndef RUBY_THREAD_PTHREAD_H
2 #define RUBY_THREAD_PTHREAD_H
13 #ifdef HAVE_PTHREAD_NP_H
14 #include <pthread_np.h>
17 #define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER
18 #define RB_NATIVETHREAD_COND_INIT PTHREAD_COND_INITIALIZER
22 enum thread_sched_waiting_flag {
23 thread_sched_waiting_none = 0x00,
24 thread_sched_waiting_timeout = 0x01,
25 thread_sched_waiting_io_read = 0x02,
26 thread_sched_waiting_io_write = 0x08,
27 thread_sched_waiting_io_force = 0x40,
32 #ifdef MY_RUBY_BUILD_MAY_TIME_TRAVEL
42 struct ccan_list_node node;
48 struct ccan_list_node ubf;
52 struct ccan_list_node readyq;
56 struct ccan_list_node timeslice_threads;
60 struct ccan_list_node running_threads;
63 struct ccan_list_node zombie_threads;
78 rb_nativethread_id_t thread_id;
80 #ifdef RB_THREAD_T_HAS_NATIVE_ID
87 #if defined(__GLIBC__) || defined(__FreeBSD__)
97 rb_nativethread_cond_t intr;
98 rb_nativethread_cond_t readyq;
101 #ifdef USE_SIGALTSTACK
108 size_t machine_stack_maxsize;
118 rb_nativethread_lock_t lock_;
124 bool is_running_timeslice;
125 bool enable_mn_threads;
127 struct ccan_list_head readyq;
130 struct ccan_list_node grq_node;
133 #ifdef RB_THREAD_LOCAL_SPECIFIER
145 #define RUBY_NT_SERIAL 1
148 typedef pthread_key_t native_tls_key_t;
151 native_tls_get(native_tls_key_t key)
154 return pthread_getspecific(key);
158 native_tls_set(native_tls_key_t key,
void *
ptr)
160 if (UNLIKELY(pthread_setspecific(key,
ptr) != 0)) {
161 rb_bug(
"pthread_setspecific error");
std::atomic< unsigned > rb_atomic_t
Type that is eligible for atomic operations.
#define RUBY_EXTERN
Declaration of externally visible global variables.
void rb_bug(const char *fmt,...)
Interpreter panic switch.
char * ptr
Pointer to the underlying memory region, of at least capa bytes.