summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-07 08:06:02 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-07 08:06:02 +0000
commit95f135960fcab59208d36a95951c43ce93f479c3 (patch)
tree564fe8d3ec46d4eb7daa4a144d1891ae1b513e58 /thread.c
parentb1bb2520c80186cf18d44574cf1b204d1560f02f (diff)
vm_core.h (rb_thread_t): use 32-bit running_time_us
The current range based current values of: TIME_QUANTUM_USEC=100000 RUBY_THREAD_PRIORITY_MAX=3 RUBY_THREAD_PRIORITY_MIN=-3 Gives a range of 12500..800000, plenty enough for a 32-bit integer. Clamping this also reduces potential implementation bugs between 32-bit and 64-bit platforms. I may consider a further reduction to uint16_t in the future for M:N threading, but some users may want slightly larger time quantums. * vm_core.h (rb_thread_t): use 32-bit running_time_us git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/thread.c b/thread.c
index c15c36fda4..a622f4bf4f 100644
--- a/thread.c
+++ b/thread.c
@@ -1247,7 +1247,7 @@ rb_thread_sleep(int sec)
}
static void
-rb_thread_schedule_limits(unsigned long limits_us)
+rb_thread_schedule_limits(uint32_t limits_us)
{
thread_debug("rb_thread_schedule\n");
if (!rb_thread_alone()) {
@@ -2085,7 +2085,7 @@ rb_threadptr_execute_interrupts(rb_thread_t *th, int blocking_timing)
}
if (timer_interrupt) {
- unsigned long limits_us = TIME_QUANTUM_USEC;
+ uint32_t limits_us = TIME_QUANTUM_USEC;
if (th->priority > 0)
limits_us <<= th->priority;