Karya, built on 2020-11-26T21:03:17 (patch 23b5be2d53a9e8e7d6136cda5aae2849abe5cded)
Safe HaskellNone

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 # 
Instance details

Defined in Util.Thread

Methods

showsPrec :: Int -> Flag -> ShowS #

show :: Flag -> String #

showList :: [Flag] -> ShowS #

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) # 
Instance details

Defined in Util.Thread

Methods

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

show :: Metric time -> String #

showList :: [Metric time] -> ShowS #