bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#9101: timeout should use setitimer if available


From: Pádraig Brady
Subject: Re: bug#9101: timeout should use setitimer if available
Date: Tue, 19 Jul 2011 23:24:48 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 19/07/11 19:45, Paul Eggert wrote:
> On 07/19/11 04:00, Pádraig Brady wrote:
> 
>> +  if (timer_create (CLOCK_REALTIME, NULL, &timerid) == -1)
>> +    error (EXIT_FAILURE, errno, _("error in timer_create"));
>> +  if (timer_settime (timerid, 0, &its, NULL) == -1)
>> +    error (EXIT_FAILURE, errno, _("error in timer_settime"));
> 
> A minor point: the usual (more-conservative, and often-faster) style
> in coreutils is to write "foo (...) != 0" rather than "foo (...) ==
> -1" for system calls that return 0 or -1.
> 
>> We could remove the setitimer stuff altogether and
>> just support 1 second resolution on darwin et. al.
>> That's by far the most common use case anyway.
> 

OK I'll do that, encompassing your fallback suggestion.

> 
>> The gnulib check could be lumped into clock_time, like:
> 
> Yes, that would work, but the clock-time module probably should stay
> decoupled from timer_settime.  How about the following (untested)
> patch instead?  The idea is to append "timeout_LDADD +=
> $(LIB_TIMER_SETTIME)" to src/Makefile.am.
> 
> diff --git a/m4/jm-macros.m4 b/m4/jm-macros.m4

I'd rather not add this into jm-macros.
How about just adding a module to gnulib
where others might find it useful too?
Proposed module attached.

cheers,
Pádraig.

Attachment: timer-time.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]