epoll-0.2.2: epoll bindings

Portabilitynon-portable
Stabilityexperimental
Maintainertoralf.wittner@gmail.com

System.Linux.Epoll.Base

Description

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.

Synopsis

Documentation

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.

Instances

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.

Instances

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 and passed to freeDesc exactly once.

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. and frees descriptor which must not be used afterwards.

freeDesc :: Descriptor a -> IO ()Source

Frees the resources associated with this descriptor. Must be called exactly once.

combineEvents :: [EventType] -> EventTypeSource

Bitwise OR of the list of EventTypes.