poller

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event added in v1.1.0

type Event struct {
	FD     int
	Events Events
}

Event is one level-triggered readiness notification. Readiness remains observable until the descriptor is no longer ready.

type EventHandler

type EventHandler interface {
	OnEvent(ep *NetPoller, fd int, events Events)
	OnClose(ep *NetPoller, err error)
}

type Events

type Events uint32

Events is a bitmask for read/write/error events. Poller implementations may pass these to OnEvent callback to handle multiple events in a single call (avoids double Get/dispatch for read+write).

const (
	ReadEvents Events = 1 << iota
	WriteEvents
)

type Interest added in v1.1.0

type Interest uint8

Interest is the desired readiness state for a watched descriptor.

const (
	Readable Interest = 1 << iota
	Writable
)

type NetPoller

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

func NewNetPoller

func NewNetPoller() (*NetPoller, error)

func (*NetPoller) Add added in v1.1.0

func (poller *NetPoller) Add(fd int, want Interest) error

Add registers a descriptor that is not already watched.

func (*NetPoller) Close

func (poller *NetPoller) Close(err error) error

func (*NetPoller) Closed added in v1.1.0

func (poller *NetPoller) Closed() bool

func (*NetPoller) Modify added in v1.1.0

func (poller *NetPoller) Modify(fd int, _ Interest, want Interest) error

Modify changes the interest of an already watched descriptor.

func (*NetPoller) Remove added in v1.1.0

func (poller *NetPoller) Remove(fd int, _ Interest) error

Remove unregisters a descriptor. previous is used by kqueue backends.

func (*NetPoller) Serve

func (poller *NetPoller) Serve(lockOSThread bool, handler EventHandler) error

Serve is retained as a compatibility wrapper around Wait.

func (*NetPoller) Wait added in v1.1.0

func (poller *NetPoller) Wait(out []Event, timeout int) (int, error)

func (*NetPoller) Wake added in v1.1.0

func (poller *NetPoller) Wake() error

Jump to

Keyboard shortcuts

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