diff options
author | Jean Boussier <[email protected]> | 2022-07-07 15:20:35 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2022-07-07 17:49:00 +0200 |
commit | 587d2d199b3f783d03266d42d066949f8a4824d3 (patch) | |
tree | 6977cca9dc954a2fa4a87dc1b7f1f0aa5bc8786b /thread_pthread.c | |
parent | 61c7ae4d27d44b19b39fa240cf7edda2eeefc92d (diff) |
thread_pthread.c: call SUSPENDED event when entering native_sleep
[Bug #18900]
Thread#join and a few other codepaths are using native sleep as
a way to suspend the current thread. So we should call the relevant
hook when this happen, otherwise some thread may transition
directly from `RESUMED` to `READY`.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6101
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/thread_pthread.c b/thread_pthread.c index 02a3640bdb..8597479765 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -2337,6 +2337,8 @@ native_sleep(rb_thread_t *th, rb_hrtime_t *rel) int sigwait_fd = rb_sigwait_fd_get(th); rb_ractor_blocking_threads_inc(th->ractor, __FILE__, __LINE__); + RB_INTERNAL_THREAD_HOOK(RUBY_INTERNAL_THREAD_EVENT_SUSPENDED); + if (sigwait_fd >= 0) { rb_native_mutex_lock(&th->interrupt_lock); th->unblock.func = ubf_sigwait; |