Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: sleep $floatval



On 2013-09-02 at 11:09 -0700, Bart Schaefer wrote:
> Hmm, sleep is a library call, not a system call, and isn't documented as
> setting errno to anything useful, so you must be planning on implementing
> the delay some other way?

nanosleep being less portable than select, I was tending towards the
second.  (I wish I were clever enough to have come up with that pun
deliberately).

> What happens if a handler invokes zsleep again with a different list of
> functions?  Also, how do you plan to keep track of whether the original
> sleep time has expired while the handlers were executing?

Track desired end time, get current time before re-entering, only
request long enough for the remaining delta.

> Other problems of having a builtin sleep include defining the interaction
> with signal handlers, particularly the ALRM handler.

Another good reason to just use select(2) instead of sleep(3). :)

-Phil



Messages sorted by: Reverse Date, Date, Thread, Author