network-mux- Multiplexing library
Safe HaskellSafe-Inferred



This module allows the management of a multiple Async jobs which are grouped by an 'Ord group => group' type.



data JobPool group m a Source #

JobPool allows to submit asynchronous jobs, wait for their completion or cancel. Jobs are grouped, each group can be cancelled separately.

data Job group m a Source #

An asynchronous job which belongs to some group and its exception handler.




withJobPool ∷ ∀ group m a b. (MonadAsync m, MonadThrow m, MonadLabelledSTM m) ⇒ (JobPool group m a → m b) → m b Source #

forkJob ∷ ∀ group m a. (MonadAsync m, MonadMask m, Ord group) ⇒ JobPool group m a → Job group m a → m () Source #

readSizeMonadSTM m ⇒ JobPool group m a → STM m Int Source #

readGroupSize ∷ (MonadSTM m, Eq group) ⇒ JobPool group m a → group → STM m Int Source #

waitForJobMonadSTM m ⇒ JobPool group m a → STM m a Source #

Wait for next successfully completed job. Unlike wait it will not throw if a job errors.

cancelGroup ∷ (MonadAsync m, Eq group) ⇒ JobPool group m a → group → m () Source #

Cancel all threads in a given group. Blocks until all threads terminated.