threaded-0.0.0: Manage concurrently operating threads without having to spark them

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.Threaded.Hash

Synopsis

Documentation

threaded Source #

Arguments

:: Hashable k 
=> Eq k 
=> Show k 
=> MonadIO m 
=> MonadBaseControl IO m stM 
=> Extractable stM 
=> TChanRW Write (k, input)

Incoming messages, identified by thread k

-> (TChanRW Read input -> TChanRW Write output -> m ())

Process to spark in a new thread. When m () returns, the thread is considered "dead", and is internally cleaned up.

-> m (Async (), TChanRW Read (k, output)) 

Segregates concurrently operating threads by some key type k. Returns the thread that processes all other threads (this function is non-blocking), and the channel that dispenses the outputs from each thread.