| Portability | non-portable |
|---|---|
| Stability | experimental |
| Maintainer | toralf.wittner@gmail.com |
System.Linux.EpollM
Description
Monadic epoll interface. Similar to System.Linux.Epoll.Base but uses
ReaderT to hold a Device instead of passing it to many functions.
- data Epoll a
- runEpoll :: Device -> Epoll a -> IO a
- runEpoll_ :: Size -> Epoll a -> IO a
- runEpollSmall_ :: Epoll a -> IO a
- runEpollMed_ :: Epoll a -> IO a
- runEpollBig_ :: Epoll a -> IO a
- add :: a -> [EventType] -> Fd -> Epoll (Descriptor a)
- add_ :: [EventType] -> Fd -> Epoll (Descriptor ())
- modify :: [EventType] -> Descriptor a -> Epoll ()
- delete :: Descriptor a -> Epoll ()
- wait :: Duration -> Epoll [Event a]
- wait_ :: Epoll [Event a]
- device :: Epoll Device
- dispatchLoop :: Duration -> (Event a -> Epoll ()) -> Epoll ()
- dispatchLoop_ :: Duration -> (Event a -> Epoll ()) -> Epoll ThreadId
- defaultDispatchLoop :: (Event a -> Epoll ()) -> Epoll ()
- defaultDispatchLoop_ :: (Event a -> Epoll ()) -> Epoll ThreadId
- fork :: Epoll () -> Epoll ThreadId
- fork_ :: Epoll () -> Epoll ()
- 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 ()
- inEvent :: EventType
- outEvent :: EventType
- peerCloseEvent :: EventType
- urgentEvent :: EventType
- errorEvent :: EventType
- hangupEvent :: EventType
- edgeTriggeredEvent :: EventType
- oneShotEvent :: EventType
Documentation
runEpoll_ :: Size -> Epoll a -> IO aSource
Run Epoll monad. Like runEpoll but creates and closes
Device implcitely.
runEpollSmall_ :: Epoll a -> IO aSource
Like runEpoll_ but with an implicit Size value of 8.
runEpollMed_ :: Epoll a -> IO aSource
Like runEpoll_ but with an implicit Size value of 256.
runEpollBig_ :: Epoll a -> IO aSource
Like runEpoll_ but with an implicit Size value of 8192.
add :: a -> [EventType] -> Fd -> Epoll (Descriptor a)Source
Adds the given file descriptor with the specified event types to epoll.
modify :: [EventType] -> Descriptor a -> Epoll ()Source
Modify the event type set of the given descriptor.
delete :: Descriptor a -> Epoll ()Source
Deletes the descriptor from epoll.
wait :: Duration -> Epoll [Event a]Source
Waits up to the given duration for events on all descriptors.
dispatchLoop :: Duration -> (Event a -> Epoll ()) -> Epoll ()Source
Waits for events and calls the given function for each.
dispatchLoop_ :: Duration -> (Event a -> Epoll ()) -> Epoll ThreadIdSource
Like dispatchLoop but forks itself into another thread
defaultDispatchLoop :: (Event a -> Epoll ()) -> Epoll ()Source
Like dispatchLoop but with predefined Duration of 500ms.
defaultDispatchLoop_ :: (Event a -> Epoll ()) -> Epoll ThreadIdSource
Like defaultDispatchLoop but forks itself into another thread
fork :: Epoll () -> Epoll ThreadIdSource
Uses forkIO to spark an epoll computation into another thread.
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