original commit: 0f8b3991c6d8e7ce947ac2950316520c68e83929
This commit is contained in:
Matthew Flatt 2004-10-11 18:58:27 +00:00
parent 7db4a6bbcb
commit 1f4a596902

View File

@ -488,21 +488,21 @@
eof
(let ([n (read-bytes-avail!* str port 0 count)])
(cond
[(eq? n 0) port]
[(eq? n 0) (wrap-evt port (lambda (x) 0))]
[(number? n) (set! got (+ got n)) n]
[else n])))))
(lambda (str skip)
(lambda (str skip progress-evt)
(let ([count (max 0 (min (- limit got skip) (bytes-length str)))])
(if (zero? count)
eof
(let ([n (peek-bytes-avail!* str skip #f port 0 count)])
(let ([n (peek-bytes-avail!* str skip progress-evt port 0 count)])
(if (eq? n 0)
port
(wrap-evt port (lambda (x) 0))
n)))))
(lambda ()
(when close-orig?
(close-input-port port)))))))
;; ----------------------------------------
(define (poll-or-spawn go)