Bug in 'process'?

Started by itistoday, June 30, 2010, 03:50:31 PM

Previous topic - Next topic

itistoday

v.10.2.9


> (begin (process "ls") (sleep 2000) (println "hi"))
hi
"hi"


Or another version:


> ((fn () (sleep 2000) (println "foo")) (process "ls"))
foo
"foo"


That happens instantly. There's no delay despite the (sleep 2000) call. Shouldn't there be a delay?
Get your Objective newLISP groove on.

itistoday

#1
Same problem with 'fork':


> (fork) (sleep 2000) (exit)
19389
2000
[shell]$
Get your Objective newLISP groove on.

Lutz

#2
The finishing 'process' and finishing 'fork' will signal the parent and cancel the 'sleep' via SIGCHLD (signal 20). This is how Unix is expected to work.



You could set the signal to either 'nil' or 'true' for SIG_IGN (ignore) or SIG_DFL (default, which in case of SIGCHLD is SIG_IGN again)).


(signal 20 nil)
(fork) (sleep 1000) (println "hi"))


now the finishing 'fork' will not interrupt the 'sleep' in the parent.



Of course a 'sleep' inside the child process is not a problem:


(fork (begin (sleep 1000) (println "hi")))

and doesn't need any signals to be handled.

itistoday

#3
OK thanks, either I forgot about that, or I never knew it to begin with. :-p



Maybe that could be mentioned in the fork/process docs? Seems like something that could trip up a lot of folks..
Get your Objective newLISP groove on.