From 82998918efa3a637c80e135198b573cfcb31acd9 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 21 Sep 2020 16:22:04 +0200 Subject: Make Thread#join always convert its argument, as before 70f08f1eed --- thread.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'thread.c') diff --git a/thread.c b/thread.c index d6a4f7ab78..510d8a028b 100644 --- a/thread.c +++ b/thread.c @@ -1313,6 +1313,17 @@ thread_join_m(int argc, VALUE *argv, VALUE self) timeout = argv[0]; } + // Convert the timeout eagerly, so it's always converted and deterministic + if (timeout == Qnil) { + /* unlimited */ + } + else if (FIXNUM_P(timeout)) { + /* handled directly in thread_join_sleep() */ + } + else { + timeout = rb_to_float(timeout); + } + return thread_join(rb_thread_ptr(self), timeout); } -- cgit v1.2.3