Front page | perl.perl5.porters |
Postings from May 2008
Re: [perl #53962] bug in Time::HiRes 5.11
Thread Previous
|
Thread Next
From:
Dmitry Karasik
Date:
May 11, 2008 09:50
Subject:
Re: [perl #53962] bug in Time::HiRes 5.11
Message ID:
84od7cpyxx.fsf@tetsuo.karasik.eu.org
Hi Dominic!
On 11 май 08 at 15:32, "Dominic" (Dominic Dunlop) wrote:
Dominic> On 2008√05√10, at 21:04, dk@tetsuo.karasik.eu.org (via RT) wrote:
>> I don't have access to perl's source repositary
Dominic> The file, with line-by-line blame, should be visible to you at
Dominic> <http://public.activestate.com/cgi-bin/perlbrowse/b/ext/Time/HiRes/HiRes.xs
>> . On brief examination, the check-in comments seem to do a good job
Dominic> of saying why particular changes were made.
Ah, excellent. That did it - so there indeed was an explanation why timeouts
less than one second were implemented using setitimer(), and otherwise
using ualarm(). I've reworked the patch, so the time limit check stays, but
only for ualarm() case, and doesn't mix with the setitimer() logic.
--- HiRes.xs.0 2008-05-10 20:02:23.000000000 +0200
+++ HiRes.xs 2008-05-11 18:44:53.000000000 +0200
@@ -925,7 +925,6 @@
CODE:
if (useconds < 0 || uinterval < 0)
croak("Time::HiRes::ualarm(%d, %d): negative time not invented yet", useconds, uinterval);
- if (useconds >= IV_1E6 || uinterval >= IV_1E6)
#if defined(HAS_SETITIMER) && defined(ITIMER_REAL)
{
struct itimerval itv;
@@ -936,10 +935,10 @@
}
}
#else
+ if (useconds >= IV_1E6 || uinterval >= IV_1E6)
croak("Time::HiRes::ualarm(%d, %d): useconds or uinterval equal to or more than %"IVdf, useconds, uinterval, IV_1E6);
+ RETVAL = ualarm(useconds, uinterval);
#endif
- else
- RETVAL = ualarm(useconds, uinterval);
OUTPUT:
RETVAL
@@ -954,7 +953,6 @@
{
IV useconds = IV_1E6 * seconds;
IV uinterval = IV_1E6 * interval;
- if (seconds >= IV_1E6 || interval >= IV_1E6)
#if defined(HAS_SETITIMER) && defined(ITIMER_REAL)
{
struct itimerval itv;
@@ -965,8 +963,9 @@
}
}
#else
- RETVAL = (NV)ualarm((IV)(seconds * IV_1E6),
- (IV)(interval * IV_1E6)) / NV_1E6;
+ if (useconds >= IV_1E6 || uinterval >= IV_1E6)
+ croak("Time::HiRes::alarm(%d, %d): seconds or interval equal to or more than 1.0 ", useconds, uinterval, IV_1E6);
+ RETVAL = (NV)ualarm( useconds, uinterval) / NV_1E6;
#endif
}
--
Sincerely,
Dmitry Karasik
Thread Previous
|
Thread Next