On 7/19/05, Daishi Kato <[EMAIL PROTECTED]> wrote: > For example, an application would be a server program > that is controlable by a user through some kind of commands. > In other words, a server program with CUI. > Currently I could do it by csi, since it does not block the server thread, > but what if I would like to compile it into a single executable? > Would char-ready? help? >
How do you communicate with the sever? If it's a sub-process, you can use `process' (posix unit) which is non-blocking: % cat slow.sh #!/bin/sh echo "hello!" sleep 1 echo "yes" sleep 3 echo "no" % cat listen.scm ;;;; listen.scm (use posix srfi-18) (thread-start! (lambda () (let loop ((i 1)) (thread-sleep! 0.5) (print "[" i "]") (loop (add1 i)) ) ) ) (define-values (i o _) (process "./slow.sh")) (port-for-each print (cut read-line i)) ; assumes Chicken 2.0, a simple loop works as well (close-input-port i) (close-output-port o) % csi -script listen.scm ... cheers, felix _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users