epoll-0.1: Low-level bindings to epoll.




Low level interface to Linux' epoll, a high performance polling mechanism which handles high numbers of file descriptors efficiently. See man epoll(7) for details.



data EventType Source

EventType corresponds to epoll's event type defines, e.g. EPOLLIN, EPOLLOUT, EPOLLET, etc.

data Size Source

Unsigned type used for length specifications.


data Duration Source

Unsigned type used for timeout specifications.

data Descriptor a Source

Event descriptor. Will be returned from add and must be passed to delete exactly once.

data Device Source

Abstract epoll device. Holds internal data. Returned from create and used in almost every other API function. Must be closed explicitely with close.

data Event a Source

A single event ocurrence.

(=~) :: EventType -> EventType -> BoolSource

Match operator. Useful to test whether an EventType returned from wait contains one of the defined event types because EventTypes returned by wait might be the bitwise OR of several EventTypes.

create :: Size -> IO DeviceSource

Creates an epoll device. Must be closed with close. The parameter Size specifies the number of events that can be reported by a single call to wait.

close :: Device -> IO ()Source

Closes epoll device.

wait :: Duration -> Device -> IO [Event a]Source

Waits for the specified duration on all event descriptors. Returns the list of events that occured.

add :: Device -> a -> [EventType] -> Fd -> IO (Descriptor a)Source

Adds a filedescriptor to the epoll watch set using the specified EventTypes. User data might be passed in as well which will be returned on event occurence as part of the Event type. Returns an event descriptor which must be deleted from the watch set with delete.

modify :: Device -> [EventType] -> Descriptor a -> IO ()Source

Modified the event types of the event descriptor.

delete :: Device -> Descriptor a -> IO ()Source

Removes the event descriptor from the epoll watch set.