Refactor and fix the GVL instrumentation API

This entirely changes how it is tested. Rather than to use counters
we now record the timeline of events with associated threads which
makes it much easier to assert that certains events are only preceded
by a specific event, and makes it much easier to debug unexpected
timelines.

Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
Co-Authored-By: JP Camara <jp@jpcamara.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
This commit is contained in:
Jean Boussier 2023-11-24 13:18:00 +01:00 committed by Jean Boussier
parent e3875dd0f8
commit 23a7714343
5 changed files with 346 additions and 134 deletions

View file

@ -5406,10 +5406,6 @@ Init_Thread(void)
// it assumes blocked by thread_sched_to_waiting().
// thread_sched_to_running(sched, th);
#ifdef RB_INTERNAL_THREAD_HOOK
RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_RESUMED, th);
#endif
th->pending_interrupt_queue = rb_ary_hidden_new(0);
th->pending_interrupt_queue_checked = 0;
th->pending_interrupt_mask_stack = rb_ary_hidden_new(0);