mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
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
This commit is contained in:
1 parent
88975c821c
commit
b3aa256c4d
1 file changed
+1
-1
+1
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user