time-manager-0.0.0: Scalable timer

Safe HaskellSafe
LanguageHaskell98

System.TimeManager

Contents

Synopsis

Types

type Manager = Reaper [Handle] Handle Source #

A timeout manager

type TimeoutAction = IO () Source #

An action to be performed on timeout.

data Handle Source #

A handle used by Manager

Manager

initialize :: Int -> IO Manager Source #

Creating timeout manager which works every N micro seconds where N is the first argument.

stopManager :: Manager -> IO () Source #

Stopping timeout manager with onTimeout fired.

killManager :: Manager -> IO () Source #

Killing timeout manager immediately without firing onTimeout.

withManager Source #

Arguments

:: Int

timeout in microseconds

-> (Manager -> IO a) 
-> IO a 

Call the inner function with a timeout manager.

Registration

register :: Manager -> TimeoutAction -> IO Handle Source #

Registering a timeout action.

registerKillThread :: Manager -> TimeoutAction -> IO Handle Source #

Registering a timeout action of killing this thread.

Control

tickle :: Handle -> IO () Source #

Setting the state to active. Manager turns active to inactive repeatedly.

cancel :: Handle -> IO () Source #

Setting the state to canceled. Manager eventually removes this without timeout action.

pause :: Handle -> IO () Source #

Setting the state to paused. Manager does not change the value.

resume :: Handle -> IO () Source #

Setting the paused state to active. This is an alias to tickle.

Exceptions