summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-09-21 14:22:04 (GMT)
committerBenoit Daloze <eregontp@gmail.com>2020-09-21 14:22:04 (GMT)
commit82998918efa3a637c80e135198b573cfcb31acd9 (patch)
tree35d37cb05261bcac266d192d371aa03c33d7f814 /thread.c
parent2b73e6ba712d35e6ec767bf722edf542cc2e47c6 (diff)
Make Thread#join always convert its argument, as before 70f08f1eed
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index d6a4f7a..510d8a0 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);
}