-- 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 1.3
-- | 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
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 -> UTCTime -> IO () -> IO EventId
-- | Atomic version of addEvent
addEventSTM :: EventSystem -> UTCTime -> 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 GHC.Show.Show Control.Event.TimerReset
instance GHC.Classes.Ord Control.Event.TimerReset
instance GHC.Classes.Eq Control.Event.TimerReset
instance GHC.Show.Show Control.Event.EventId
instance GHC.Classes.Ord Control.Event.EventId
instance GHC.Classes.Eq Control.Event.EventId
instance GHC.Exception.Type.Exception Control.Event.TimerReset
-- | This module uses Haskell concurrency libraries to build an extremely
-- simple event system that should perform better than the Control.Event
-- module but does not provide features such as STM action scheduling.
module Control.Event.Relative
type EventId = (ThreadId, MVar Bool)
-- | 'addEvent delay action' will delay for delay microseconds
-- then execute action. An EventId is returned, allowing the
-- event to be canceled.
addEvent :: Int -> IO () -> IO EventId
-- | 'delEvent eid' deletes the event and returns True if the event
-- was deleted. If False is returned then the time elapsed and the
-- action was forked off.
delEvent :: EventId -> IO Bool
-- | This module is a shim, providing the control-timeout api using
-- control-event to run the show. See the control-timeout package for
-- documentation. If you do not need compatability with the
-- control-timeout api then do not use this module!
module Control.Event.Timeout
addTimeout :: Float -> IO () -> IO TimeoutTag
addTimeoutAtomic :: Float -> IO (IO () -> IO (STM TimeoutTag))
cancelTimeout :: TimeoutTag -> STM Bool
data TimeoutTag