Joel VanderWerf
10/10/2008 5:33:00 PM
Joel VanderWerf wrote:
> Dave Thomas wrote:
>>
>> On Oct 10, 2008, at 10:47 AM, Ricardo Giorni wrote:
>>
>>> I need a sleep based on cpu ticks, or something like this, does ruby has
>>> a way to do this? Anyone has an alternative for it, or a ruby sleep
>>> implementation based on ticks?
>>
>> Does your system support select()?
>
> Doesn't #sleep use select() anyway, via rb_thread_wait_for()?
Apparently so:
$ strace ruby -e '3.times {sleep 1}' 2>&1 | tail
time(NULL) = 1223660042
time(NULL) = 1223660042
select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
time(NULL) = 1223660043
time(NULL) = 1223660043
select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
time(NULL) = 1223660044
rt_sigaction(SIGINT, {SIG_DFL}, {0x80b5320, [], 0}, 8) = 0
exit_group(0) = ?
Process 6665 detached
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407