summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--thread_sync.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/thread_sync.c b/thread_sync.c
index 5e511af0db..777b08a271 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);
}