Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Control.Concurrent.Threaded
Synopsis
- data ThreadedInternal incoming outgoing = ThreadedInternal {
- thread :: Async ()
- outputRelay :: Async ()
- threadInput :: TChanRW Read incoming
- threadOutput :: TChanRW Write outgoing
- threaded :: forall m stM k input output. Ord k => Show k => MonadIO m => MonadBaseControl IO m stM => Extractable stM => TChanRW Write (k, input) -> (TChanRW Read input -> TChanRW Write output -> m ()) -> m (Async (), TChanRW Read (k, output))
Documentation
data ThreadedInternal incoming outgoing Source #
Constructors
ThreadedInternal | |
Fields
|
Arguments
:: Ord k | |
=> Show k | |
=> MonadIO m | |
=> MonadBaseControl IO m stM | |
=> Extractable stM | |
=> TChanRW Write (k, input) | Incoming messages, identified by thread |
-> (TChanRW Read input -> TChanRW Write output -> m ()) | Process to spark in a new thread. When |
-> 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.