ISO C 9x time API: delay
Markus.Kuhn at cl.cam.ac.uk
Fri Oct 9 09:36:40 UTC 1998
"Clive D.W. Feather" wrote on 1998-10-08 19:25 UTC:
> This is not the right standard for a delay function; that's a much more
> OS-specific operation and belongs in an OS standard like POSIX.
> Just the same as "kbhit()" doesn't belong in the C Standard.
The distinction of what belongs into a programming language standard and
what belongs into an OS standard is generally pretty arbitrary and based
mostly on historic accidents.
Some languages (Java and Ada come to mind) for instance say that
concurrency (multi-threading) and scheduling belong into the programming
language standard, while others (C, Fortran, Pascal) leave this to OS
API standards such as POSIX and Win32. In Ada, delay is even a reserved
keyword (like return) and not just a library function (mostly because
delay can not only be used as a statement of its own but also to
timelimit alternatives in select statements).
C does contain numerous functions that do block on external events
(getchar()), and it does contain a clock interface, so I see no
convincing argument of not also including a function that would allow
one to block on a clock. For me, a delay function is just another form
of accessing a clock, something very similar to reading a clock.
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org, home page: <http://www.cl.cam.ac.uk/~mgk25/>
More information about the tz