Documentation
¶
Index ¶
- Constants
- func Dup(fd int) (int, string, error)
- func SetKeepAlive(fd int, d time.Duration) error
- func SetNoDelay(fd int, noDelay bool) error
- func SockaddrToTCPOrUnixAddr(sa unix.Sockaddr) net.Addr
- func SockaddrToUDPAddr(sa unix.Sockaddr) net.Addr
- type Poller
- func (p *Poller) AddRead(fd int) error
- func (p *Poller) AddReadWrite(fd int) error
- func (p *Poller) AddWrite(fd int) error
- func (p *Poller) Close() error
- func (p *Poller) Delete(fd int) error
- func (p *Poller) ModRead(fd int) error
- func (p *Poller) ModReadWrite(fd int) error
- func (p *Poller) Polling(callback func(fd int, ev uint32) error) error
- func (p *Poller) Trigger(task queue.Task) (err error)
Constants ¶
const ( // InitEvents represents the initial length of poller event-list. InitEvents = 128 // AsyncTasks is the maximum number of asynchronous tasks that the event-loop will process at one time. AsyncTasks = 64 // ErrEvents represents exceptional events that are not read/write, like socket being closed, // reading/writing from/to a closed socket, etc. ErrEvents = unix.EPOLLERR | unix.EPOLLHUP | unix.EPOLLRDHUP // OutEvents combines EPOLLOUT event and some exceptional events. OutEvents = ErrEvents | unix.EPOLLOUT // InEvents combines EPOLLIN/EPOLLPRI events and some exceptional events. InEvents = ErrEvents | unix.EPOLLIN | unix.EPOLLPRI )
Variables ¶
This section is empty.
Functions ¶
func SetKeepAlive ¶
SetKeepAlive sets whether the operating system should send keep-alive messages on the connection and sets period between keep-alive's.
func SetNoDelay ¶ added in v1.4.0
SetNoDelay controls whether the operating system should delay packet transmission in hopes of sending fewer packets (Nagle's algorithm).
The default is true (no delay), meaning that data is sent as soon as possible after a Write.
func SockaddrToTCPOrUnixAddr ¶
SockaddrToTCPOrUnixAddr converts a Sockaddr to a net.TCPAddr or net.UnixAddr. Returns nil if conversion fails.
Types ¶
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
Poller represents a poller which is in charge of monitoring file-descriptors.
func (*Poller) AddRead ¶
AddRead registers the given file-descriptor with readable event to the poller.
func (*Poller) AddReadWrite ¶
AddReadWrite registers the given file-descriptor with readable and writable events to the poller.
func (*Poller) AddWrite ¶
AddWrite registers the given file-descriptor with writable event to the poller.
func (*Poller) ModRead ¶
ModRead renews the given file-descriptor with readable event in the poller.
func (*Poller) ModReadWrite ¶
ModReadWrite renews the given file-descriptor with readable and writable events in the poller.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package queue delivers an implementation of lock-free concurrent queue based on the algorithm presented by Maged M. Michael and Michael L. Scot.
|
Package queue delivers an implementation of lock-free concurrent queue based on the algorithm presented by Maged M. Michael and Michael L. Scot. |