Brendan O'Dea wrote:
> On Thu, Nov 01, 2007 at 11:00:21PM +0100, Matthijs Melchior wrote:
>   
>> Time::HiRes ualarm does not work anymore.
>>
>> The following command will demonstrate the error from the
>> 'setitimer' system call:
>>
>> strace perl -e 'use Time::HiRes qw(ualarm); ualarm 2000000; sleep 4; ualarm 
>> 200000; sleep 4'
>>     
>
> Works for me:
>
>     [gkar:~]  strace -enanosleep perl -MTime::HiRes=usleep -e 'usleep 2000000'
>     nanosleep({2, 0}, {2, 0})               = 0
>     nanosleep({0, 0}, NULL)                 = 0
>     Process 12403 detached
>     [gkar:~] uname -a
>     Linux gkar 2.6.22-2-amd64 #1 SMP Thu Aug 30 23:43:59 UTC 2007 x86_64 
> GNU/Linux
>
> --bod
>   
Yes, indeed, there is no problem with usleep. The problem I noticed is
with ualarm:

/home/mmelchio> strace -e setitimer perl -MTime::HiRes=ualarm -e 'ualarm
2000000; sleep 4'
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 2000000}},
0xbfe91468) = -1 EINVAL (Invalid argument)
Process 23574 detached
/home/mmelchio> strace -e setitimer perl -MTime::HiRes=ualarm -e 'ualarm
200000; sleep 4'
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 200000}},
{it_interval={0, 0}, it_value={0, 0}}) = 0
--- SIGALRM (Alarm clock) @ 0 (0) ---
+++ killed by SIGALRM +++
Process 23588 detached
/home/mmelchio> uname -a
Linux p2pc 2.6.22-2-686 #1 SMP Fri Aug 31 00:24:01 UTC 2007 i686 GNU/Linux
/home/mmelchio>

As you can see, 2 seconds fails, and 0.2 seconds is OK.

Thanks for staring the investigation.

-- 
Regards,
----------------------------------------------------------------  -o)
Matthijs Melchior                                       Maarssen  /\\
[EMAIL PROTECTED]          +31 346 570616          Netherlands _\_v
---------------------------------------------------------------- ----




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to