Safe Haskell | None |
---|---|
Language | Haskell2010 |
System.TimeManager
Synopsis
- data Manager
- type TimeoutAction = IO ()
- data Handle
- initialize :: Int -> IO Manager
- stopManager :: Manager -> IO ()
- killManager :: Manager -> IO ()
- withManager :: Int -> (Manager -> IO a) -> IO a
- withManager' :: Int -> (Manager -> IO a) -> IO a
- withHandle :: Manager -> TimeoutAction -> (Handle -> IO a) -> IO (Maybe a)
- withHandleKillThread :: Manager -> TimeoutAction -> (Handle -> IO ()) -> IO ()
- tickle :: Handle -> IO ()
- pause :: Handle -> IO ()
- resume :: Handle -> IO ()
- register :: Manager -> TimeoutAction -> IO Handle
- registerKillThread :: Manager -> TimeoutAction -> IO Handle
- cancel :: Handle -> IO ()
- data TimeoutThread = TimeoutThread
Types
type TimeoutAction = IO () #
An action to be performed on timeout.
Manager
initialize :: Int -> IO Manager #
Creating timeout manager which works every N micro seconds where N is the first argument.
stopManager :: Manager -> IO () #
Stopping timeout manager with onTimeout fired.
killManager :: Manager -> IO () #
Killing timeout manager immediately without firing onTimeout.
Call the inner function with a timeout manager.
stopManager
is used after that.
Call the inner function with a timeout manager.
killManager
is used after that.
Registering a timeout action
withHandle :: Manager -> TimeoutAction -> (Handle -> IO a) -> IO (Maybe a) #
Registering a timeout action and unregister its handle
when the body action is finished.
Nothing
is returned on timeout.
withHandleKillThread :: Manager -> TimeoutAction -> (Handle -> IO ()) -> IO () #
Registering a timeout action of killing this thread and unregister its handle when the body action is killed or finished.
Control timeout
Setting the state to active.
Manager
turns active to inactive repeatedly.
Low level
registerKillThread :: Manager -> TimeoutAction -> IO Handle #
Registering a timeout action of killing this thread.
TimeoutThread
is thrown to the thread which called this
function on timeout. Catch TimeoutThread
if you don't
want to leak the asynchronous exception to GHC RTS.
Exceptions
data TimeoutThread #
The asynchronous exception thrown if a thread is registered via
registerKillThread
.
Constructors
TimeoutThread |
Instances
Exception TimeoutThread # | |
Defined in System.TimeManager Methods toException :: TimeoutThread -> SomeException # fromException :: SomeException -> Maybe TimeoutThread # displayException :: TimeoutThread -> String # backtraceDesired :: TimeoutThread -> Bool # | |
Show TimeoutThread # | |
Defined in System.TimeManager Methods showsPrec :: Int -> TimeoutThread -> ShowS # show :: TimeoutThread -> String # showList :: [TimeoutThread] -> ShowS # |