Poller waits for readiness notifications from multiple file descriptors.
The wait can be interrupted by calling Close.
type Poller struct {
// contains filtered or unexported fields
}
func New() (*Poller, error)
func (p *Poller) Add(fd int, id int) error
Add an fd to the poller.
id is returned by Wait in the unix.EpollEvent.Pad field any may be zero. It must not exceed math.MaxInt32.
Add is blocked by Wait.
func (p *Poller) Close() error
Close the poller.
Interrupts any calls to Wait. Multiple calls to Close are valid, but subsequent calls will return os.ErrClosed.
func (p *Poller) Wait(events []unix.EpollEvent) (int, error)
Wait for events.
Returns the number of pending events or an error wrapping os.ErrClosed if Close is called.