poolboy-0.2.2.0: Simple work queue for bounded concurrency
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Poolboy

Synopsis

Configuration

data PoolboySettings Source #

Initial settings

Constructors

PoolboySettings 

poolboySettingsWith :: Int -> PoolboySettings Source #

Arbitrary-numbered settings

simpleSerializedLogger :: IO (String -> IO ()) Source #

Simple (but not particularly performant) serialized logger

Running

withPoolboy :: PoolboySettings -> WaitingStopStrategy -> (WorkQueue -> IO a) -> IO a Source #

backet-based usage (recommended)

newPoolboy :: PoolboySettings -> IO WorkQueue Source #

Standalone/manual usage

Driving

changeDesiredWorkersCount :: WorkQueue -> Int -> IO () Source #

Request a worker number adjustment

waitReadyQueue :: WorkQueue -> IO () Source #

Block until one worker is available

Stopping

stopWorkQueue :: WorkQueue -> IO () Source #

Request stopping wrokers

isStopedWorkQueue :: WorkQueue -> IO Bool Source #

Non-blocking check of the work queue's running status

waitingStopTimeout :: Int -> WaitingStopStrategy Source #

Block until the queue is totally stopped or deadline (in micro seconds) is reached

waitingStopFinishWorkers :: WaitingStopStrategy Source #

Block until the queue is totally stopped (no more running worker)

Enqueueing

enqueue :: WorkQueue -> IO () -> IO () Source #

Enqueue one action in the work queue (non-blocking)

enqueueAfter :: Foldable f => WorkQueue -> IO () -> f (IO ()) -> IO () Source #

Enqueue action and some actions to be run after it