aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-05 08:56:52 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-05 08:56:52 +0000
commitd0cc69bfacce09e4cf471928ea08d31098d2100f (patch)
tree04496be6efb2c051b128c9c4ae1f90c78fa9cda3 /thread_pthread.c
parent9c58512af4484e698e6032be6935694bfb31ff7e (diff)
downloadruby-d0cc69bfacce09e4cf471928ea08d31098d2100f.tar.gz
thread_pthread.c (native_sleep): reduce ppoll sleeps
By holding into sigwait_fd until after we acquire GVL, we can hit the faster native_cond_sleep path instead of ppoll when another thread wants to start sleeping. ppoll-ing on sigwait_fd isn't really useful in program where GVL is contended This also allows reducing vm->gvl.lock mutex contention on waitpid sleep migrations. r64170 this patch vm_thread_condvar1 0.921 1.356 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 39b8e79f49..33443ac054 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1716,9 +1716,9 @@ native_sleep(rb_thread_t *th, struct timespec *timeout_rel)
check_signals_nogvl(th, sigwait_fd);
}
unblock_function_clear(th);
+ GVL_UNLOCK_END(th);
rb_sigwait_fd_put(th, sigwait_fd);
rb_sigwait_fd_migrate(th->vm);
- GVL_UNLOCK_END(th);
}
else {
native_cond_sleep(th, timeout_rel);