Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Util.Thread

Synopsis

Documentation

startLogged :: String -> IO.IO () -> IO.IO Concurrent.ThreadId Source #

Start a noisy thread that will log when it starts and stops, and warn if it dies from an exception.

type Seconds = NominalDiffTime Source #

This is just NominalDiffTime, but with a name I might remember.

delay :: Seconds -> IO.IO () Source #

Delay in seconds.

Flag

data Flag Source #

A Flag starts False, and can eventually become True. It never goes back to False again.

Instances

Instances details
Show Flag Source # 
Instance details

Defined in Util.Thread

Methods

showsPrec :: Int -> Flag -> ShowS #

show :: Flag -> String #

showList :: [Flag] -> ShowS #

Eq Flag Source # 
Instance details

Defined in Util.Thread

Methods

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

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

set :: Flag -> IO.IO () Source #

wait :: Flag -> IO.IO () Source #

Wait until the flag becomes true.

poll :: Seconds -> Flag -> IO.IO Bool Source #

Wait a finite amount of time for the flag to become true.

timing

timeAction :: MonadIO m => m a -> m (a, Metric Seconds) Source #

Time an IO action in CPU and wall seconds. Technically not thread related, but I don't have a better place at the moment.

timeActionText :: MonadIO m => m a -> m (a, Text) Source #

Like timeAction, but return a Text msg instead of the values.

printTimer :: Text -> (a -> String) -> IO.IO a -> IO.IO a Source #

printTimer_ :: MonadIO m => Text -> m a -> m a Source #

printTimerVal :: (DeepSeq.NFData a, MonadIO m) => Text -> a -> m a Source #

map concurrent

forCpu_ :: [a] -> (a -> IO.IO b) -> IO.IO () Source #

Metric

data Metric time Source #

Constructors

Metric 

Fields

Instances

Instances details
Show time => Show (Metric time) Source # 
Instance details

Defined in Util.Thread

Methods

showsPrec :: Int -> Metric time -> ShowS #

show :: Metric time -> String #

showList :: [Metric time] -> ShowS #