poll

package
v0.0.0-...-b61cfef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExceptionEvents represents problematic epoll events.
	ExceptionEvents = unix.EPOLLHUP |

		unix.EPOLLRDHUP |

		unix.EPOLLERR // read end closed

	// ReadEvents represents read epoll events.
	ReadEvents = ExceptionEvents |

		unix.EPOLLIN |

		unix.EPOLLPRI //exceptional condition, visit https://man7.org/linux/man-pages/man2/poll.2.html

	// WriteEvents represents write epoll events.
	WriteEvents = ExceptionEvents |

		unix.EPOLLOUT // associated file is available for write operation

	// ReadWriteEvents represents both read and write epoll events.
	ReadWriteEvents = ReadEvents | WriteEvents
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Poller

type Poller struct {
	// contains filtered or unexported fields
}

Poller is responsible for watching file descriptors for events.

func New

func New() (*Poller, error)

New returns a newly created poller.

func (*Poller) AddRead

func (p *Poller) AddRead(fd int) error

AddRead put the fs in epoll's interest list with read event on.

func (*Poller) Watch

func (p *Poller) Watch(processEventFn func(fd int, eFlags uint32) error) error

Watch monitors the epoll for events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL