summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2023-03-31 17:57:25 +0900
committerKoichi Sasada <ko1@atdot.net>2023-03-31 18:50:10 +0900
commitf803bcfc872b31faeb1b894e315175e410024cd5 (patch)
treec20ae62c10b317b0c69429720912078fa17b17e1 /thread_pthread.c
parent4c0f82eb5b13e436a93497eaf23d965efa35a39e (diff)
downloadruby-f803bcfc872b31faeb1b894e315175e410024cd5.tar.gz
pass `th` to `thread_sched_to_waiting()`
for future extension
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index c74569604a..d9af238c88 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -521,7 +521,7 @@ thread_sched_to_running(struct rb_thread_sched *sched, rb_thread_t *th)
}
static rb_thread_t *
-thread_sched_to_waiting_common(struct rb_thread_sched *sched)
+thread_sched_to_waiting_common(struct rb_thread_sched *sched, rb_thread_t *th)
{
rb_thread_t *next;
sched->running = NULL;
@@ -532,19 +532,19 @@ thread_sched_to_waiting_common(struct rb_thread_sched *sched)
}
static void
-thread_sched_to_waiting(struct rb_thread_sched *sched)
+thread_sched_to_waiting(struct rb_thread_sched *sched, rb_thread_t *th)
{
RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_SUSPENDED);
rb_native_mutex_lock(&sched->lock);
- thread_sched_to_waiting_common(sched);
+ thread_sched_to_waiting_common(sched, th);
rb_native_mutex_unlock(&sched->lock);
}
static void
-thread_sched_to_dead(struct rb_thread_sched *sched)
+thread_sched_to_dead(struct rb_thread_sched *sched, rb_thread_t *th)
{
RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_EXITED);
- thread_sched_to_waiting(sched);
+ thread_sched_to_waiting(sched, th);
}
static void
@@ -558,7 +558,7 @@ thread_sched_yield(struct rb_thread_sched *sched, rb_thread_t *th)
*/
ubf_wakeup_all_threads();
rb_native_mutex_lock(&sched->lock);
- next = thread_sched_to_waiting_common(sched);
+ next = thread_sched_to_waiting_common(sched, th);
/* An another thread is processing GVL yield. */
if (UNLIKELY(sched->wait_yield)) {
@@ -2209,7 +2209,7 @@ ubf_ppoll_sleep(void *ignore)
struct rb_thread_sched *sched = TH_SCHED(th); \
RB_VM_SAVE_MACHINE_CONTEXT(th); \
rb_native_mutex_lock(&sched->lock); \
- next = thread_sched_to_waiting_common(sched); \
+ next = thread_sched_to_waiting_common((sched), (th)); \
rb_native_mutex_unlock(&sched->lock); \
if (!next && rb_ractor_living_thread_num(th->ractor) > 1) { \
native_thread_yield(); \