cancelreader_unix.go

 1//go:build solaris
 2// +build solaris
 3
 4package cancelreader
 5
 6import (
 7	"io"
 8)
 9
10// NewReader returns a reader and a cancel function. If the input reader is a
11// File, the cancel function can be used to interrupt a blocking read call.
12// In this case, the cancel function returns true if the call was canceled
13// successfully. If the input reader is not a File or the file descriptor
14// is 1024 or larger, the cancel function does nothing and always returns false.
15// The generic unix implementation is based on the posix select syscall.
16func NewReader(reader io.Reader) (CancelReader, error) {
17	return newSelectCancelReader(reader)
18}