summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2022-07-07 15:20:35 +0200
committerJean Boussier <jean.boussier@gmail.com>2022-07-07 17:49:00 +0200
commit587d2d199b3f783d03266d42d066949f8a4824d3 (patch)
tree6977cca9dc954a2fa4a87dc1b7f1f0aa5bc8786b /thread_pthread.c
parent61c7ae4d27d44b19b39fa240cf7edda2eeefc92d (diff)
downloadruby-587d2d199b3f783d03266d42d066949f8a4824d3.tar.gz
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`.
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c2
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;