Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | toralf.wittner@gmail.com |
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
- data Size
- toSize :: Int -> Maybe Size
- data Duration
- toDuration :: Int -> Maybe Duration
- data Descriptor a
- data Device
- data Event a
- (=~) :: EventType -> EventType -> Bool
- create :: Size -> IO Device
- close :: Device -> IO ()
- wait :: Duration -> Device -> IO [Event a]
- add :: Device -> a -> [EventType] -> Fd -> IO (Descriptor a)
- modify :: Device -> [EventType] -> Descriptor a -> IO ()
- delete :: Device -> Descriptor a -> IO ()
- freeDesc :: Descriptor a -> IO ()
- inEvent :: EventType
- outEvent :: EventType
- peerCloseEvent :: EventType
- urgentEvent :: EventType
- errorEvent :: EventType
- hangupEvent :: EventType
- edgeTriggeredEvent :: EventType
- oneShotEvent :: EventType
- combineEvents :: [EventType] -> EventType
Documentation
EventType corresponds to epoll's event type defines, e.g. EPOLLIN, EPOLLOUT, EPOLLET, etc.
Unsigned type used for timeout specifications.
toDuration :: Int -> Maybe DurationSource
data Descriptor a Source
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 EventType
s.