| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
System.SimpleTimeout
Description
Intended for internal use: Simple timeout mechanism
Synopsis
- data TimeoutHandle
- timeoutHandle :: Double -> IO TimeoutHandle
- timeout :: TimeoutHandle -> (Double -> IO a) -> IO a -> IO a
Documentation
data TimeoutHandle Source #
Abstract data structure used by TimeoutHandle and timeout.
timeoutHandle :: Double -> IO TimeoutHandle Source #
Creates a TimeoutHandle.
The Double parameter is the time limit in seconds.
All operations behind timeout will be stopped
at the current time plus the time limit.
Arguments
| :: TimeoutHandle | knows the time of the timeout and the creation time of itself |
| -> (Double -> IO a) | timeout handling action for which will the percent will be supplied |
| -> IO a | the operation to timeout |
| -> IO a |
Stop an operation at a time given by timeoutHandle.
The Double parameter is a percent between 0 and 1.
- 0:
timeoutwas called right after theTimeoutHandlewas created. - 1:
timeoutwas called after the time of the timeout. - near to 1:
timeoutwas called right before the time of the timeout. - Other values: proportional to the time spend by the operation.