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

Re: sleep $floatval



On Sep 1,  7:33pm, Phil Pennock wrote:
}
} Say I do add a zsleep command; if the sleep returns EINTR, then before

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?

} going back to sleep for the remainder of the duration, the command could
} report on reaped jobs immediately, so that instead of being pre-prompt,
} job termination could be reported immediately during the length of the
} sleep.

That might be better expressed explicitly (even if implemented the same
way underneath) by providing a variant of "wait" that has a timeout,
rather than by having a variant of "sleep" that does it implicitly.

} (At which point, zsleep might as well take an option giving it a
} function list variable to be be walked, any time it is woken up, to let
} arbitrary handlers be invoked, before resuming sleep, and possibly with
} a way to abort and avoid going back to sleep).

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?

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



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