Walter C. Pelissero writes:
> I hope I'm not offending anyone forwarding a private mail to the
> mailing list.
>
Not me ;-)
> >>>>> "Matthew" == Matthew R Wette <mwette_at_grover.jpl.nasa.gov> writes:
>
> Matthew> Try using select() (or poll()) instead of sleep.
>
> Too easy. That would be doing the same as (after 1000). In fact it
> works.
>
> BTW the sleep(3) manual page on FreeBSD says:
>
> This function is implemented using setitimer(2); it requires eight sys-
> tem calls each time it is invoked. A similar but less compatible func-
> tion can be obtained with a single select(2); such a function would not
> restart after signals, but would not interfere with other uses of
> setitimer(2).
>
> and again:
>
> In practice the FreeBSD implementation will not be interrupted: it will
> always return the original argument or zero. Code that depends on sleep
> being interrupted (using it as a timed pause, for example) needs to be
> recoded to use select(2) or some other delay mechanism. Code that calls
> sleep() repeatedly until it returns zero may busy-wait until a timer is
> available.
>
> Mmh, this might be the culprit. But the mechanism behind this failure
> still escape my comprehension.
>
> It would be interesting to try my former code in a non-FreeBSD system.
I didn't know this limitation with sleep on BSD.
On Linux, the implementation of sleep you provided works.
BTW select is not Posix and I generally avoid using such system calls,
but since Tk relies for its event loop on select, I think it's not a
problem ;-)
Do you have an implementation I can use? In particular, is it
useful to allow delay of less than a second?
-- Erick
Received on Sun Nov 08 1998 - 20:20:53 CET
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST