threads-extras-0.1.0.3: Extends the threads package with a bounded thread group

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.Thread.BoundedThreadGroup

Description

This module wraps Control.Concurrent.Thread.Group and provides a bounded version of ThreadGroup, mainly BoundedThreadGroup.

In addition to the functionality of ThreadGroup, BoundedThreadGroup will block creation of threads until there fewer than the given max size.

Synopsis

Documentation

data BoundedThreadGroup Source #

A BoundedThreadGroup extends the concept of a ThreadGroup by restricting the number of active threads to a given max size. If one attempts to create more than the max size number of threads the fork function will block until threads finish.

new :: Int -> IO BoundedThreadGroup Source #

Create a new BoundedThreadGroup with the passed in max size

nrOfRunning :: BoundedThreadGroup -> STM Int Source #

Same as Control.Concurrent.Thread.Group.nrOfRunning

wait :: BoundedThreadGroup -> IO () Source #

Same as Control.Concurrent.Thread.Group.wait

waitN :: Int -> BoundedThreadGroup -> IO () Source #

Same as Control.Concurrent.Thread.Group.waitN

forkIO :: BoundedThreadGroup -> IO a -> IO (ThreadId, IO (Result a)) Source #

Same as Control.Concurrent.Thread.Group.forkIO but waits there are less then the max size number of threads.

forkOS :: BoundedThreadGroup -> IO a -> IO (ThreadId, IO (Result a)) Source #

Same as Control.Concurrent.Thread.Group.forkOS but waits there are less then the max size number of threads.

forkOn :: Int -> BoundedThreadGroup -> IO a -> IO (ThreadId, IO (Result a)) Source #

Same as Control.Concurrent.Thread.Group.forkOn but waits there are less then the max size number of threads.

forkIOWithUnmask :: BoundedThreadGroup -> ((forall b. IO b -> IO b) -> IO a) -> IO (ThreadId, IO (Result a)) Source #

Same as Control.Concurrent.Thread.Group.forkIOWithUnmask but waits there are less then the max size number of threads.

forkOnWithUnmask :: Int -> BoundedThreadGroup -> ((forall b. IO b -> IO b) -> IO a) -> IO (ThreadId, IO (Result a)) Source #

Same as Control.Concurrent.Thread.Group.forkOnWithUnmask but waits there are less then the max size number of threads.