-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Event scheduling system. -- -- Allows scheduling and canceling of IO actions to be executed at a -- specified future time. @package control-event @version 0.3.0 -- | 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. -- -- This differs from control-timeout in that control-event is: * More -- complex * Requires initilization * Allows pure STM adding and removing -- of events (no post STM IO action) * Allows user control over event -- systems (can have more than one) * Allows events to run in event -- handler thread (advisable if thread spark is too expensive / -- computation is cheap) * No possible duplication of EventId -- (theoretical! no real advantage) -- -- A shim has been made providing control-timeout API with Control.Event -- running under the hood (called Control.Event.Timeout). module Control.Event -- | IDs useful for canceling previously scheduled events. data EventId -- | The event system must be initilized using initEventSystem. More than -- one event system can be instantiated at once (eg. for -- non-interference). data EventSystem -- | A value indicating there is no such event. Canceling this event -- returns True and has no other effect. noEvent :: EventId -- | The only way to get an event system is to initilize one initEventSystem :: IO EventSystem -- | Add an *action* to be performed at *time* by *system*. Returns a -- unique ID. addEvent :: EventSystem -> ClockTime -> IO () -> IO EventId -- | Atomic version of addEvent addEventSTM :: EventSystem -> ClockTime -> IO () -> STM EventId -- | Cancel an event from the system, returning True on success. cancelEvent :: EventSystem -> EventId -> IO Bool -- | Atomic version of cancelEvent cancelEventSTM :: EventSystem -> EventId -> STM Bool -- | Returns the number of pending events. evtSystemSize :: EventSystem -> STM Int instance Typeable TimerReset instance Eq TimerReset instance Ord TimerReset instance Show TimerReset instance Eq EventId instance Ord EventId instance Show EventId -- | This module is a shim, providing the control-timeout api using -- control-event to run the show module Control.Event.Timeout addTimeout :: Float -> (IO ()) -> IO TimeoutTag addTimeoutAtomic :: Float -> IO () -> IO (STM TimeoutTag) cancelTimeout :: TimeoutTag -> STM Bool data TimeoutTag