(flet ((maybe-update-timeout ()
;; If we return early, recompute the timeouts, possibly
;; signaling the deadline or returning with NIL to caller.
- (multiple-value-bind (sec usec)
- (decode-internal-time (get-internal-real-time))
- (setf to-sec (- stop-sec sec))
- (cond ((> usec stop-usec)
- (decf to-sec)
- (setf to-usec (- (+ stop-usec 1000000) usec)))
- (t
- (setf to-usec (- stop-usec usec)))))
- (when (or (minusp to-sec) (and (zerop to-sec) (not (plusp to-usec))))
+ (setf (values to-sec to-usec)
+ (relative-decoded-times stop-sec stop-usec))
+ (when (and (zerop to-sec) (not (plusp to-usec)))
(cond (signalp
(signal-deadline)
(go :restart))
(loop for to-msec = (if (and to-sec to-usec)
(+ (* 1000 to-sec) (truncate to-usec 1000))
-1)
- when (sb!unix:unix-simple-poll fd direction to-msec)
+ when (or #!+win32 (eq direction :output)
+ (sb!unix:unix-simple-poll fd direction to-msec))
do (return-from wait-until-fd-usable t)
else
do (when to-sec (maybe-update-timeout))))))))
(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)))
+ (with-simple-restart (remove-fd-handler "Remove ~S" handler)
+ (funcall (handler-function handler)
+ (handler-descriptor handler))
+ (go :next))
+ (remove-fd-handler handler)
+ :next)
t))))))