- ;; Next, wait for something to happen.
- (multiple-value-bind (value err)
- (sb!unix:unix-fast-select count
- (sb!alien:addr read-fds)
- (sb!alien:addr write-fds)
- nil to-sec to-usec)
- #!+win32
- (declare (ignore err))
- ;; Now see what it was (if anything)
- (cond ((not value)
- ;; Interrupted or one of the file descriptors is bad.
- ;; FIXME: Check for other errnos. Why do we return true
- ;; when interrupted?
- #!-win32
- (if (eql err sb!unix:eintr)
- t
- (handler-descriptors-error))
- #!+win32
- (handler-descriptors-error))
- ((plusp value)
- ;; Got something. Call file descriptor handlers
- ;; according to the readable and writable masks
- ;; returned by select.
- (dolist (handler
- (select-descriptor-handlers
- (lambda (handler)
- (let ((fd (handler-descriptor handler)))
- (ecase (handler-direction handler)
- (:input (sb!unix:fd-isset fd read-fds))
- (:output (sb!unix:fd-isset fd write-fds)))))))
- (funcall (handler-function handler)
- (handler-descriptor handler)))
- t)
- ((zerop value)
- ;; Timeout.
- (cond (poll
- (funcall poll)
- (sub-serve-event more-sec more-usec deadlinep))
- (deadlinep
- (signal-deadline))))))))))
+ ;; Next, wait for something to happen.
+ (multiple-value-bind (value err)
+ (sb!unix:unix-fast-select count
+ (sb!alien:addr read-fds)
+ (sb!alien:addr write-fds)
+ nil to-sec to-usec)
+ #!+win32
+ (declare (ignore err))
+ ;; Now see what it was (if anything)
+ (cond ((not value)
+ ;; Interrupted or one of the file descriptors is bad.
+ ;; FIXME: Check for other errnos. Why do we return true
+ ;; when interrupted?
+ #!-win32
+ (case err
+ (#.sb!unix:ebadf
+ (handler-descriptors-error))
+ ((#.sb!unix:eintr #.sb!unix:eagain)
+ t)
+ (otherwise
+ (with-simple-restart (continue "Ignore failure and continue.")
+ (simple-perror "Unix system call select() failed"
+ :errno err))))
+ #!+win32
+ (handler-descriptors-error))
+ ((plusp value)
+ ;; Got something. Call file descriptor handlers
+ ;; according to the readable and writable masks
+ ;; returned by select.
+ (dolist (handler
+ (select-descriptor-handlers
+ (lambda (handler)
+ (let ((fd (handler-descriptor handler)))
+ (ecase (handler-direction handler)
+ (:input (sb!unix:fd-isset fd read-fds))
+ (:output (sb!unix:fd-isset fd write-fds)))))))
+ (funcall (handler-function handler)
+ (handler-descriptor handler)))
+ t))))))