Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Util.Thread

Contents

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
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 Source #

Arguments

:: MonadIO m 
=> m a 
-> m (a, Seconds, Seconds)

(a, cpu, wall)

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 #