stack-tag-0.2.0: Create etags for Haskell projects based on Stack snapshots

Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.Async.Pool

Description

Simple implementation for limiting the number of active threads during concurrent computations using a semaphore.

Synopsis

Documentation

mapPool :: Traversable t => Int -> (a -> IO b) -> t a -> IO (t b) Source #

Limit the number of threads which can be active at any given time when using mapConcurrently. The downside is that this function will allocate all threads at once.

mapCapabilityPool :: Traversable t => (a -> IO b) -> t a -> IO (t b) Source #

Map async using getNumCapabilities to determine the number of active threads.

This function is a bit misleading as it doesn't actually utilize forkOn or exploit any control over whether the threads are spread across physical processors. It does, however, provide a nice starting point for most of the threads used in this program which are heavily IO bound.