Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- withWorkerQueue :: (t -> IO a) -> ContT () IO (TQueue t)
- awaitRunInThread :: TQueue (IO ()) -> IO result -> IO result
Documentation
withWorkerQueue :: (t -> IO a) -> ContT () IO (TQueue t) Source #
withWorkerQueue
creates a new TQueue
, and launches a worker
thread which polls the queue for requests and runs the given worker
function on them.
awaitRunInThread :: TQueue (IO ()) -> IO result -> IO result Source #
awaitRunInThread
queues up an IO
action to be run by a worker thread,
and then blocks until the result is computed.