mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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.
This commit is contained in:
parent
7bd172744f
commit
982641939c
3 changed files with 114 additions and 53 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue