| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
System.TimeManager
Description
Timeout manager. Since v0.3.0, timeout manager is a wrapper of GHC System TimerManager.
Users of old version should check the current semantics.
Synopsis
- data Manager
- defaultManager :: Manager
- type TimeoutAction = IO ()
- data Handle
- emptyHandle :: 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 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
defaultManager :: Manager Source #
A manager whose timeout value is 0 (no callbacks are fired).
type TimeoutAction = IO () Source #
An action (callback) to be performed on timeout.
emptyHandle :: Handle Source #
Dummy Handle.
Manager
initialize :: Int -> IO Manager Source #
Creating timeout manager with a timeout value in microseconds.
Setting the timeout to zero or lower (<= 0) will produce a
defaultManager.
stopManager :: Manager -> IO () Source #
Deprecated: This function does nothing since version 0.3.0
Obsoleted since version 0.3.0
Is now equivalent to pure ().
killManager :: Manager -> IO () Source #
Deprecated: This function does nothing since version 0.3.0
Obsoleted since version 0.3.0
Is now equivalent to pure ().
Call the inner function with a timeout manager.
Deprecated: This function is the same as withManager since version 0.3.0
Call the inner function with a timeout manager.
This is identical to withManager.
Registering a timeout action
withHandle :: Manager -> TimeoutAction -> (Handle -> IO a) -> IO a Source #
Registering a timeout action and unregister its handle when the body action is finished.
withHandleKillThread :: Manager -> TimeoutAction -> (Handle -> IO ()) -> IO () Source #
Registering a timeout action of killing this thread and unregister its handle when the body action is killed or finished.
Control timeout
Low level
registerKillThread :: Manager -> TimeoutAction -> IO Handle Source #
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 Source #
The asynchronous exception thrown if a thread is registered via
registerKillThread.
Constructors
| TimeoutThread |
Instances
| Exception TimeoutThread Source # | |
Defined in System.TimeManager Methods toException :: TimeoutThread -> SomeException # fromException :: SomeException -> Maybe TimeoutThread # displayException :: TimeoutThread -> String # | |
| Show TimeoutThread Source # | |
Defined in System.TimeManager Methods showsPrec :: Int -> TimeoutThread -> ShowS # show :: TimeoutThread -> String # showList :: [TimeoutThread] -> ShowS # | |