network-mux-0.2.0.0: Multiplexing library
Safe HaskellNone
LanguageHaskell2010

Control.Concurrent.JobPool

Description

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

Synopsis

Documentation

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.

Constructors

Job 

Fields

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 #

readSize ∷ MonadSTM m ⇒ JobPool group m a → STM m Int Source #

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

waitForJob ∷ MonadSTM 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.