Documentation
¶
Overview ¶
nolint:revive
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCanceled = fmt.Errorf("read cancelled")
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface {
io.ReadWriteCloser
// Fd returns its file descriptor
Fd() uintptr
// Name returns its file name.
Name() string
}
File represents an input/output resource with a file descriptor.
type Reader ¶
type Reader interface {
io.ReadCloser
// Cancel cancels ongoing and future reads an returns true if it succeeded.
Cancel() bool
}
Reader is a io.Reader whose Read() calls can be cancelled without data being consumed. The Reader has to be closed.
func NewReader ¶
NewReader returns a reader and a cancel function. If the input reader is an File, the cancel function can be used to interrupt a blocking call read call. In this case, the cancel function returns true if the call was cancelled 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.