path: root/thread_sync.c
diff options
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-18 04:24:31 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-18 04:24:31 (GMT)
commitd7ddbff2954ba22b71bdfeba4b94e1c4fb91efb0 (patch)
treeb70e18c4d50da1aff73184b948760633ba9afe98 /thread_sync.c
parent38f137276dad459fdbacfb3acdc720eb4137cc04 (diff)
thread_sync.c (do_sleep): avoid thread-switch/interrupt check
Calling rb_mutex_sleep directly should avoid thread-switching/interrupt checking which can lead to occasional failures. Unfortunately, this means overriding Mutex#sleep is no longer supported. Will let this commit run for a bit see if CI failures from ConditionVariable specs continue... cf. [ruby-core:88524] [Bug #14999] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_sync.c')
1 files changed, 6 insertions, 0 deletions
diff --git a/thread_sync.c b/thread_sync.c
index 5e511af..777b08a 100644
--- a/thread_sync.c
+++ b/thread_sync.c
@@ -1358,6 +1358,12 @@ static VALUE
do_sleep(VALUE args)
struct sleep_call *p = (struct sleep_call *)args;
+ if (rb_obj_class(p->mutex) == rb_cMutex) {
+ return rb_mutex_sleep(p->mutex, p->timeout);
+ }
+ /* FIXME: Mutex_m may still check interrupts here */
return rb_funcallv(p->mutex, id_sleep, 1, &p->timeout);