From 62c69768ba0139721eff923cb8031db1a6049e92 Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 9 Nov 2018 23:24:14 +0000 Subject: [PATCH] thread_pthread.c (rb_sigwait_sleep): add note about spurious wakeup I already forgot why we needed to jump through such hoops :x [ruby-core:88102] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/thread_pthread.c b/thread_pthread.c index aa5fe66adc..1f2ac00b67 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1981,6 +1981,9 @@ rb_sigwait_sleep(rb_thread_t *th, int sigwait_fd, const rb_hrtime_t *rel) * tricky: this needs to return on spurious wakeup (no auto-retry). * But we also need to distinguish between periodic quantum * wakeups, so we care about the result of consume_communication_pipe + * + * We want to avoid spurious wakeup for Mutex#sleep compatibility + * [ruby-core:88102] */ for (;;) { const rb_hrtime_t *sto = sigwait_timeout(th, sigwait_fd, &to, &n);