Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion base/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,23 @@ function isopen(x::Union{LibuvStream, LibuvServer})
return x.status != StatusClosed
end

function isclosing(x::Union{LibuvStream, LibuvServer})
return x.status == StatusClosing
end

"""
isclosed(x)

Determine whether a stream has been closed. Return true if the steram has been
closed. In general, `isclosed(x) == !isopen(x)`.
"""
function isclosed(x::Union{LibuvStream, LibuvServer})
return x.status == StatusClosed
end
isclosed(x) = !isopen(x)

function check_open(x::Union{LibuvStream, LibuvServer})
if !isopen(x) || x.status == StatusClosing
if !isopen(x) || isclosing(x)
throw(IOError("stream is closed or unusable", 0))
end
end
Expand Down