io: streamline bytes output port

This commit is contained in:
Matthew Flatt 2019-01-14 18:16:27 -07:00
parent 0e6c441f37
commit 94a4f6d703
2 changed files with 7 additions and 5 deletions

View File

@ -180,7 +180,9 @@
(pipe-discard-all o))))
#:self o
#:evt o
#:write-out o
#:write-out
(lambda (o src-bstr src-start src-end nonblock? enable-break? copy?)
((core-output-port-write-out o) (core-port-self o) src-bstr src-start src-end nonblock? enable-break? copy?))
#:close
(lambda (o) ((core-port-close o) (core-port-self o)))
#:get-write-evt

View File

@ -33,6 +33,10 @@
(if zero-ok?
0
(try-again out extra-count-outs))]
[(exact-positive-integer? v)
(port-count-all! out extra-count-outs v bstr start)
(end-atomic)
v]
[(evt? v)
(end-atomic)
(cond
@ -43,10 +47,6 @@
(sync v)))
(start-atomic)
(result-loop new-v)])]
[(exact-positive-integer? v)
(port-count-all! out extra-count-outs v bstr start)
(end-atomic)
v]
[else
(end-atomic)
(internal-error (format "write-some-bytes: weird result ~s for ~s ~s ~s at ~s" v bstr start end out))]))]