import "github.com/pkg/poller"
Package poller provides level triggered readiness notification and reliable closing of file descriptors.
type Pollable struct {
// contains filtered or unexported fields
}
Pollable represents a file descriptor that can be read/written and polled/waited for readiness notification.
func (p *Pollable) Close() error
Close deregisters the Pollable and closes the underlying file descriptor.
func (p *Pollable) Read(b []byte) (int, error)
Read reads up to len(b) bytes from the underlying fd. It returns the number of bytes read and an error, if any. EOF is signaled by a zero count with err set to io.EOF.
Callers to Read will block if there is no data available to read.
func (p *Pollable) WaitRead() error
WaitRead waits for the Pollable to become ready for reading.
func (p *Pollable) WaitWrite() error
WaitWrite waits for the Pollable to become ready for writing.
func (p *Pollable) Write(b []byte) (int, error)
Write writes len(b) bytes to the fd. It returns the number of bytes written and an error, if any. Write returns a non-nil error when n != len(b).
Callers to Write will block if there is no buffer capacity available.
type Poller struct {
// contains filtered or unexported fields
}
A Poller provides readiness notification and reliable closing of registered file descriptors.
func New() (*Poller, error)
New creates a new Poller.
func (p *Poller) Register(fd uintptr) (*Pollable, error)
Register registers a file describtor with the Poller and returns a Pollable which can be used for reading/writing as well as readiness notification.
File descriptors registered with the poller will be placed into non-blocking mode.
Generated by godoc2md