poll

package
v0.0.0-...-2aa8555 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PointerTCPFD

func PointerTCPFD(ln interface{}) int

func SetKeepAlive

func SetKeepAlive(fd, secs int) error

func SocketFD

func SocketFD(ln interface{}) (fd int, err error)

system takes the net Listener and makes it non-blocking.

func TCPFD

func TCPFD(ln reflect.Value) int

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewConn

func NewConn(conn net.Conn) (*Conn, error)

func (*Conn) Close

func (c *Conn) Close() error

Close closes the Connection.

func (*Conn) FD

func (c *Conn) FD() int

FD return the scoket fd

type Event

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

func NewEvent

func NewEvent(fd int) Event

func (Event) Data

func (ev Event) Data() unsafe.Pointer

func (Event) DataByte

func (ev Event) DataByte() *byte

func (Event) DataInt

func (ev Event) DataInt() int32

func (Event) FD

func (ev Event) FD() int

func (Event) Type

func (ev Event) Type() EventType

type EventType

type EventType int
const (
	EEvent EventType = iota << 1
	REvent
	WEvent
)

type Listener

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

Listener only TCP mode links are supported

func NewListener

func NewListener(ln net.Listener) (Listener, error)

func (*Listener) Accept

func (ln *Listener) Accept() (conn *Conn, err error)

func (*Listener) Close

func (ln *Listener) Close() error

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*Listener) FD

func (ln *Listener) FD() int

FD return the listener fd

type Poll

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

Poll ...

func OpenPoll

func OpenPoll() (*Poll, error)

OpenPoll ...

func (*Poll) AddRead

func (p *Poll) AddRead(fd int, data unsafe.Pointer) error

AddRead ...

func (*Poll) AddReadWrite

func (p *Poll) AddReadWrite(fd int, data unsafe.Pointer) error

AddReadWrite ...

func (*Poll) Close

func (p *Poll) Close() error

Close ...

func (*Poll) ModRead

func (p *Poll) ModRead(ev Event) error

func (*Poll) ModReadWrite

func (p *Poll) ModReadWrite(ev Event) error

ModReadWrite ...

func (*Poll) Remove

func (p *Poll) Remove(fd int, data unsafe.Pointer) error

ModDetach ...

func (*Poll) Wait

func (p *Poll) Wait(iter func(ev Event) error) error

Wait ...

Jump to

Keyboard shortcuts

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