summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorKoichi Sasada <[email protected]>2023-12-23 05:23:53 +0900
committerKoichi Sasada <[email protected]>2023-12-23 05:56:02 +0900
commita4b737213eb1d8f352f1f148c27e96a3f09f5d08 ()
tree0d09da7bdedf7e22186039b07427a92fe362623a /thread_pthread.c
parentc974ee1abe5df5a4bb97264e608afbd134c77652 (diff)
MN: ceil timeout milli seconds
`hrrel / RB_HRTIME_PER_MSEC` floor the timeout value and it can return wrong value by `Mutex#sleep` (return Integer even if it should return nil (timeout'ed)). This ceil the value and the issue was solved.
-rw-r--r--thread_pthread.c2
1 files changed, 1 insertions, 1 deletions
@@ -2872,7 +2872,7 @@ timer_thread_set_timeout(rb_vm_t *vm)
RUBY_DEBUG_LOG("th:%u now:%lu rel:%lu", rb_th_serial(th), (unsigned long)now, (unsigned long)hrrel);
// TODO: overflow?
- timeout = (int)(hrrel / RB_HRTIME_PER_MSEC); // ms
}
}
rb_native_mutex_unlock(&timer_th.waiting_lock);