~ chicken-core (chicken-5) 49b92ba0bfb7ecfceb49a45f64e9943ea83a6d94
commit 49b92ba0bfb7ecfceb49a45f64e9943ea83a6d94 Author: felix <felix@call-with-current-continuation.org> AuthorDate: Wed Jul 6 08:02:33 2011 +0200 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Wed Jul 6 08:02:33 2011 +0200 removed def and use of fdset for error flags diff --git a/scheduler.scm b/scheduler.scm index 975c507f..08c8a5cf 100644 --- a/scheduler.scm +++ b/scheduler.scm @@ -31,7 +31,7 @@ (hide ready-queue-head ready-queue-tail ##sys#timeout-list ##sys#update-thread-state-buffer ##sys#restore-thread-state-buffer remove-from-ready-queue ##sys#unblock-threads-for-i/o ##sys#force-primordial - fdset-input-set fdset-output-set fdset-error-set fdset-clear + fdset-input-set fdset-output-set fdset-clear fdset-select-timeout fdset-set fdset-test create-fdset stderr ##sys#clear-i/o-state-for-thread! ##sys#abandon-mutexes) @@ -74,10 +74,9 @@ C_word C_msleep(C_word ms) { return C_SCHEME_TRUE; } #endif -static fd_set C_fdset_input, C_fdset_output, C_fdset_error; +static fd_set C_fdset_input, C_fdset_output; #define C_fd_test_input(fd) C_mk_bool(FD_ISSET(C_unfix(fd), &C_fdset_input)) #define C_fd_test_output(fd) C_mk_bool(FD_ISSET(C_unfix(fd), &C_fdset_output)) -#define C_fd_test_error(fd) C_mk_bool(FD_ISSET(C_unfix(fd), &C_fdset_error)) EOF ) ) @@ -367,8 +366,7 @@ EOF (define fdset-clear (foreign-lambda* void () "FD_ZERO(&C_fdset_input);" - "FD_ZERO(&C_fdset_output);" - "FD_ZERO(&C_fdset_error);") ) + "FD_ZERO(&C_fdset_output);")) (define fdset-input-set (foreign-lambda* void ([int fd]) @@ -378,13 +376,8 @@ EOF (foreign-lambda* void ([int fd]) "FD_SET(fd, &C_fdset_output);" ) ) -(define fdset-error-set - (foreign-lambda* void ([int fd]) - "FD_SET(fd, &C_fdset_error);" ) ) - (define (fdset-set fd i/o) (dbg "setting fdset for " fd " to " i/o) - (fdset-error-set fd) (case i/o ((#t #:input) (fdset-input-set fd)) ((#f #:output) (fdset-output-set fd)) @@ -393,11 +386,11 @@ EOF (fdset-output-set fd) ) (else (panic "fdset-set: invalid i/o direction")))) -(define (fdset-test inf outf errf i/o) +(define (fdset-test inf outf i/o) (case i/o - ((#t #:input) (or inf errf)) - ((#f #:output) (or outf errf)) - ((#:all) (or inf outf errf)) + ((#t #:input) inf) + ((#f #:output) outf) + ((#:all) (or inf outf)) (else (panic "fdset-test: invalid i/o direction")))) (define (##sys#thread-block-for-i/o! t fd i/o) @@ -441,9 +434,8 @@ EOF (let* ([a (car lst)] [fd (car a)] [inf (##core#inline "C_fd_test_input" fd)] - [outf (##core#inline "C_fd_test_output" fd)] - [errf (##core#inline "C_fd_test_error" fd)] ) - (dbg "fd " fd " state: input=" inf ", output=" outf ", error=" errf) + [outf (##core#inline "C_fd_test_output" fd)]) + (dbg "fd " fd " state: input=" inf ", output=" outf) (if (or inf outf errf) (let loop2 ((threads (cdr a)) (keep '())) (if (null? threads) @@ -465,7 +457,7 @@ EOF (loop2 (cdr threads) keep)) ((not (eq? fd (car p))) (panic "thread is registered for I/O on unknown file-descriptor")) - ((fdset-test inf outf errf (cdr p)) + ((fdset-test inf outf (cdr p)) (when (##sys#slot t 4) ; also blocked for timeout? (##sys#remove-from-timeout-list t)) (##sys#thread-basic-unblock! t)Trap