Re: [coreutils] slimmer alternative to sleep command?

Ralf Wildenhues <[email protected]> Sat, 24 Jan 2009 18:40:19 +0100
Newsgroups gmane.comp.gnu.utils
Organization Department of Numerical Simulation, University of Bonn
Message-ID <[email protected]>
Hello Chris,

* Chris Jones wrote on Sat, Jan 24, 2009 at 06:36:32PM CET:
> Given a bash script that runs an infinite loop such as:
> 
>   do forever:
>     get data
>     print data
>     sleep 1
>   done
> 
> I was wondering if I could avoid the overhead of starting and
> terminating the sleep child process by using a different strategy. 

Try not polling, but just waiting for the producer of the data to be
ready.  Maybe your script can read a token (or the data itself) from a
pipe, and the producer write to the pipe?

Cheers,
Ralf