-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Updatable one-shot timer polled with STM
--   
--   This library lets you create a one-shot timer, poll it using STM, and
--   update it to ring at a different time than initially specified.
--   
--   It uses GHC event manager timeouts when available (GHC 7.2+,
--   -threaded, non-Windows OS), yielding performance similar to
--   threadDelay and registerDelay. Otherwise, it falls
--   back to forked threads and threadDelay.
--   
--   
--   
- 0.1.1.2 (2025-05-08)
--   
--   
--   
--   
- Remove a call to ensureIOManagerIsRunning, for consistency with
--   System.Timeout
--   
- Adjust timings in the testsuite to fix intermittent failure in the
--   non-threaded RTS case.
--   
--   
--   
--   
- 0.1.1 (2014-09-14)
--   
--   
--   
--   
- Add tryWaitDelayIO, improve performance for certain cases of
--   newDelay and updateDelay, and improve example.
--   
@package stm-delay
@version 0.1.1.2

-- | One-shot timer whose duration can be updated. Think of it as an
--   enhanced version of registerDelay.
--   
--   This uses GHC.Event when available (GHC 7.2+,
--   -threaded, non-Windows OS). Otherwise, it falls back to
--   forked threads and threadDelay.
module Control.Concurrent.STM.Delay

-- | A Delay is an updatable timer that rings only once.
data Delay

-- | Create a new Delay that will ring in the given number of
--   microseconds.
newDelay :: Int -> IO Delay

-- | Set an existing Delay to ring in the given number of
--   microseconds (from the time updateDelay is called), rather than
--   when it was going to ring. If the Delay has already rung, do
--   nothing.
updateDelay :: Delay -> Int -> IO ()

-- | Set a Delay so it will never ring, even if updateDelay
--   is used later. If the Delay has already rung, do nothing.
cancelDelay :: Delay -> IO ()

-- | Block until the Delay rings. If the Delay has already
--   rung, return immediately.
waitDelay :: Delay -> STM ()

-- | Non-blocking version of waitDelay. Return True if the
--   Delay has rung.
tryWaitDelay :: Delay -> STM Bool

-- | Faster version of atomically . tryWaitDelay.
--   See readTVarIO.
--   
--   Since 0.1.1
tryWaitDelayIO :: Delay -> IO Bool
instance GHC.Classes.Eq Control.Concurrent.STM.Delay.Delay
