cancelreader_unix.go 632 B

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