diff options
author | John Hawthorn <john@hawthorn.email> | 2023-11-29 15:54:32 -0800 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2023-12-02 10:06:07 -0800 |
commit | ad54fbf281ca1935e79f4df1460b0106ba76761e (patch) | |
tree | ae560415a2804342a0e7ef13f7cf6e245752960c /thread_pthread_mn.c | |
parent | 715cf9b6902b0cc317fbc5cea0df153e14ff7277 (diff) | |
download | ruby-ad54fbf281ca1935e79f4df1460b0106ba76761e.tar.gz |
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 <matthew@trebex.net>
Diffstat (limited to 'thread_pthread_mn.c')
-rw-r--r-- | thread_pthread_mn.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |