Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCanceled = fmt.Errorf("read canceled")
ErrCanceled gets returned when trying to read from a canceled reader.
Functions ¶
This section is empty.
Types ¶
type CancelReader ¶
type CancelReader interface { io.ReadCloser // Cancel cancels ongoing and future reads an returns true if it succeeded. Cancel() bool }
CancelReader is a io.Reader whose Read() calls can be canceled without data being consumed. The cancelReader has to be closed.
func NewReader ¶
func NewReader(reader io.Reader) (CancelReader, error)
NewReader returns a reader and a cancel function. If the input reader is a File, the cancel function can be used to interrupt a blocking read call. In this case, the cancel function returns true if the call was canceled successfully. If the input reader is not a File, the cancel function does nothing and always returns false. The Linux implementation is based on the epoll mechanism.
Click to show internal directories.
Click to hide internal directories.