control-event-1.3: Event scheduling system.

Safe HaskellSafe
LanguageHaskell2010

Control.Event

Description

This module can execute events at specified time. It uses a two thread system that allows the STM adding and deleting of new threads without requiring later IO actions. For a simpler system that uses relative times see Control.Event.Relative

Synopsis

Documentation

data EventId Source #

IDs useful for canceling previously scheduled events.

Instances
Eq EventId Source # 
Instance details

Defined in Control.Event

Methods

(==) :: EventId -> EventId -> Bool #

(/=) :: EventId -> EventId -> Bool #

Ord EventId Source # 
Instance details

Defined in Control.Event

Show EventId Source # 
Instance details

Defined in Control.Event

data EventSystem Source #

The event system must be initilized using initEventSystem. More than one event system can be instantiated at once (eg. for non-interference).

noEvent :: EventId Source #

A value indicating there is no such event. Canceling this event returns True and has no other effect.

initEventSystem :: IO EventSystem Source #

The only way to get an event system is to initilize one

addEvent :: EventSystem -> UTCTime -> IO () -> IO EventId Source #

Add an *action* to be performed at *time* by *system*. Returns a unique ID.

addEventSTM :: EventSystem -> UTCTime -> IO () -> STM EventId Source #

Atomic version of addEvent

cancelEvent :: EventSystem -> EventId -> IO Bool Source #

Cancel an event from the system, returning True on success.

cancelEventSTM :: EventSystem -> EventId -> STM Bool Source #

Atomic version of cancelEvent

evtSystemSize :: EventSystem -> STM Int Source #

Returns the number of pending events.