threadDelay
Suspends the current thread for a given number of microseconds (GHC
only).
There is no guarantee that the thread will be rescheduled promptly
when the delay has expired, but the thread will never continue to run
earlier than specified.
Be careful not to exceed maxBound :: Int, which on 32-bit
machines is only 2147483647 μs, less than 36 minutes. Consider using
Control.Concurrent.Thread.Delay.delay from
unbounded-delays package.
Suspends the current thread for a given number of microseconds (GHC
only).
There is no guarantee that the thread will be rescheduled promptly
when the delay has expired, but the thread will never continue to run
earlier than specified.
Yields the current thread, and optionally suspends the current thread
for a given number of microseconds.
If suspended, there is no guarantee that the thread will be
rescheduled promptly when the delay has expired, but the thread will
never continue to run earlier than specified.
threadDelay _ = yield
Convenient version of
threadDelay which takes any time-unit and
operates in any MonadIO.
>>> threadDelay $ sec 2
>>> threadDelay (2 :: Time Second)
>>> threadDelay @Second 2
Yield/delay the current thread.
This is a magic number and it is overloaded, and used at several
places to achieve batching:
- If we have to sleep to slowdown this is the minimum period that we
accumulate before we sleep. Also, workers do not stop until this much
sleep time is accumulated.
- Collected latencies are computed and transferred to measured
latency after a minimum of this period.
Will yield/delay the current thread.
Random thread delay between 0 and the specified max