diff options
author | Jean Boussier <[email protected]> | 2023-11-28 11:03:13 +0100 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2023-11-28 20:06:55 +0100 |
commit | 982641939cf709d22dbc060df57cbed31acd3b97 (patch) | |
tree | d98e8696650c0df3960a974bdab62c1fc6c1d38a /thread_pthread.c | |
parent | 7bd172744f7e40b6f840f2b9d35e73f5020a3005 (diff) |
Further fix the GVL instrumentation API
Followup: https://github.com/ruby/ruby/pull/9029
[Bug #20019]
Some events still weren't triggered from the right place.
The test suite was also improved a bit more.
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index f7619df46a..a8cf8c6126 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -799,6 +799,7 @@ thread_sched_to_ready_common(struct rb_thread_sched *sched, rb_thread_t *th, boo VM_ASSERT(sched->running != th); VM_ASSERT(!thread_sched_readyq_contain_p(sched, th)); + RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_READY, th); if (sched->running == NULL) { thread_sched_set_running(sched, th); @@ -807,8 +808,6 @@ thread_sched_to_ready_common(struct rb_thread_sched *sched, rb_thread_t *th, boo else { thread_sched_enq(sched, th); } - - RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_READY, th); } // waiting -> ready @@ -1068,7 +1067,6 @@ ubf_waiting(void *ptr) // not sleeping yet. } else { - RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_SUSPENDED, th); thread_sched_to_ready_common(sched, th, true, false); } } @@ -1086,6 +1084,8 @@ thread_sched_to_waiting_until_wakeup(struct rb_thread_sched *sched, rb_thread_t RB_VM_SAVE_MACHINE_CONTEXT(th); setup_ubf(th, ubf_waiting, (void *)th); + RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_SUSPENDED, th); + thread_sched_lock(sched, th); { if (!RUBY_VM_INTERRUPTED(th->ec)) { |