From ad54fbf281ca1935e79f4df1460b0106ba76761e Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 29 Nov 2023 15:54:32 -0800 Subject: Add missing GVL hooks for M:N threads and ractors [Bug #20019] This fixes GVL instrumentation in three locations it was missing: - Suspending when blocking on a Ractor - Suspending when doing a coroutine transfer from an M:N thread - Resuming after an M:N thread starts Co-authored-by: Matthew Draper --- thread_pthread_mn.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'thread_pthread_mn.c') diff --git a/thread_pthread_mn.c b/thread_pthread_mn.c index aa69515f32..e516d787b3 100644 --- a/thread_pthread_mn.c +++ b/thread_pthread_mn.c @@ -74,6 +74,8 @@ thread_sched_wait_events(struct rb_thread_sched *sched, rb_thread_t *th, int fd, RB_VM_SAVE_MACHINE_CONTEXT(th); setup_ubf(th, ubf_event_waiting, (void *)th); + RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_SUSPENDED, th); + thread_sched_lock(sched, th); { if (th->sched.waiting_reason.flags == thread_sched_waiting_none) { @@ -418,6 +420,7 @@ co_start(struct coroutine_context *from, struct coroutine_context *self) thread_sched_add_running_thread(TH_SCHED(th), th); thread_sched_unlock(sched, th); { + RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_RESUMED, th); call_thread_start_func_2(th); } thread_sched_lock(sched, NULL); -- cgit v1.2.3