Struct udt::Epoll [] [src]

pub struct Epoll { /* fields omitted */ }

Used with the epoll* methods of a UDTSocket

The epoll functions provides a highly scalable and efficient way to wait for UDT sockets IO events. It should be used instead of select and selectEx when the application needs to wait for a very large number of sockets. In addition, epoll also offers to wait on system sockets at the same time, which can be convenient when an application uses both UDT and TCP/UDP.

Applications should use Epoll::create to create an epoll ID and use add_usock/ssock and remove_usock/ssock to add/remove sockets. If a socket is already in the epoll set, it will be ignored if being added again. Adding invalid or closed sockets will cause error. However, they will simply be ignored without any error returned when being removed.

Multiple epoll entities can be created and there is no upper limits as long as system resource allows. There is also no hard limit on the number of UDT sockets. The number system descriptors supported by UDT::epoll are platform dependent.

For system sockets on Linux, developers may choose to watch individual events from EPOLLIN (read), EPOLLOUT (write), and EPOLLERR (exceptions). When using epoll_remove_ssock, if the socket is waiting on multiple events, only those specified in events are removed. The events can be a combination (with "|" operation) of any of the following values.

Methods

impl Epoll
[src]

Creates a new Epoll object

Adds a UdtSocket to an epoll

events can be any combination of UDT_EPOLL_IN, UDT_EPOLL_OUT, and UDT_EPOLL_ERR

Removes a UdtSocket from an epoll

If the socket isn't part of the epoll, there is no error

Wait for events

Timeout is in milliseconds. If negative, wait forever. If zero, return immediately.

If write is false, the list of sockets for writing will always be null.

Returns

A tuple of sockets to be read and sockets to be written (or have exceptions)

Trait Implementations

impl Debug for Epoll
[src]

Formats the value using the given formatter.