diff options
author | Koichi Sasada <[email protected]> | 2024-04-28 07:19:09 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2024-07-09 05:57:03 +0900 |
commit | ffc69eec0a5746d48ef3cf649639c67631a6a609 () | |
tree | 656785b344a3744c94477464a6d834dea6e859c6 /thread_pthread.h | |
parent | a9f6bd028af5e91efbba59dd1cb542c5f40aee91 (diff) |
`struct rb_thread_sched_waiting`
Introduce `struct rb_thread_sched_waiting` and `timer_th.waiting` can contain other than `rb_thread_t`.
-rw-r--r-- | thread_pthread.h | 50 |
1 files changed, 26 insertions, 24 deletions
@@ -17,6 +17,31 @@ #define RB_NATIVETHREAD_LOCK_INIT PTHREAD_MUTEX_INITIALIZER #define RB_NATIVETHREAD_COND_INIT PTHREAD_COND_INITIALIZER // per-Thead scheduler helper data struct rb_thread_sched_item { struct { @@ -38,30 +63,7 @@ struct rb_thread_sched_item { struct ccan_list_node zombie_threads; } node; - // this data should be protected by timer_th.waiting_lock - struct { - enum thread_sched_waiting_flag { - thread_sched_waiting_none = 0x00, - thread_sched_waiting_timeout = 0x01, - thread_sched_waiting_io_read = 0x02, - thread_sched_waiting_io_write = 0x08, - thread_sched_waiting_io_force = 0x40, // ignore readable - } flags; - - struct { - // should be compat with hrtime.h -#ifdef MY_RUBY_BUILD_MAY_TIME_TRAVEL - int128_t timeout; -#else - uint64_t timeout; -#endif - int fd; // -1 for timeout only - int result; - } data; - - // connected to timer_th.waiting - struct ccan_list_node node; - } waiting_reason; bool finished; bool malloc_stack; |