data-pprint-0.2.4.2: Prettyprint and compare Data values
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.SimpleTimeout

Description

Intended for internal use: Simple timeout mechanism

Synopsis

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.

timeout Source #

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: timeout was called right after the TimeoutHandle was created.
  • 1: timeout was called after the time of the timeout.
  • near to 1: timeout was called right before the time of the timeout.
  • Other values: proportional to the time spend by the operation.