I thought that an implementation of sleep() for STk wouldn't exploit
any bug. I was wrong.
Here is my sleep code:
static PRIMITIVE
stk_sleep (SCM time)
{
if (NEXACTP(time))
Err("sleep: bad number of seconds", time);
sleep(STk_integer_value(time));
return UNDEFINED;
}
PRIMITIVE
STk_init_sleep ()
{
STk_add_new_primitive("sleep", tc_subr_1, stk_sleep);
return UNDEFINED;
}
Amazingly the following line doesn't work:
(let loop () (display (exec "echo foo")) (sleep 1) (loop))
but this works:
(let loop () (display "foo\n") (sleep 1) (loop))
and this works as well:
(let loop () (display (exec "echo foo")) (after 1000) (loop))
The problem is that after the first foo line the program stops (I
guess in exec, because it exits from sleep).
This could be OS dependent (FreeBSD 2.2.2), but I haven't a clue.
Received on Sun Nov 01 1998 - 22:57:16 CET
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST