High CPU usage on chickens > 4.8.0 pasted by mario-goulart on Fri Feb 22 19:07:34 2013
#!/bin/sh #| -*- scheme -*- exec csi -s $0 "$@" |# (use posix srfi-18) (define (async-process thunk) (receive (in out) (create-pipe) (process-fork (lambda () (file-close in) (thunk) (file-close out))) (file-close out) in)) (define (wait fd) (thread-start! (lambda () (thread-wait-for-i/o! fd) (file-close fd)))) (define proc1 (async-process (lambda () (print "Hi from proc1") (system "sleep 5") (print "proc1 done sleeping 5 secs")))) (define proc2 (async-process (lambda () (print "Hi from proc2") (system "sleep 2") (print "proc2 done sleeping 2 sec")))) (define (mainloop) (let ((t1 (wait proc1)) (t2 (wait proc2))) (let loop () (print "--") (thread-sleep! 0.9) (loop)))) (mainloop)
This stops the high CPU usage added by mario-goulart on Sat Feb 23 02:20:21 2013
diff --git a/scheduler.scm b/scheduler.scm index f42ae09..ad9de37 100644 --- a/scheduler.scm +++ b/scheduler.scm @@ -82,7 +82,7 @@ static struct pollfd *C_fdset_set = NULL; C_inline int C_fd_ready(int fd, int pos, int what) { assert(fd == C_fdset_set[pos].fd); /* Must match position in ##sys#fd-list! */ - return(C_fdset_set[pos].revents & what); + return(C_fdset_set[pos].revents); } #define C_fd_input_ready(fd,pos) C_mk_bool(C_fd_ready(C_unfix(fd), C_unfix(pos),POLLIN))