The spec for Base.eof says "If the stream is not yet exhausted, this function will block to wait for more data if necessary, and then return false.".
The current implementation of Base.eof(::FIFOBuffer) does not block:
|
Base.eof(f::FIFOBuffer) = f.eof && f.nb == 0 |
The problem is that stream consumers who do while !eof(io) ... rely on the blocking behaviour to avoid spinning at 100% cpu while waiting for data. e.g.: base/io.jl
function write(to::IO, from::IO)
while !eof(from)
write(to, readavailable(from))
end
end
Context of the discovery of this issue: #110