| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Worker.WorkQueue
Description
Internal to the arbiter packages. Not covered by the PVP.
Batch queue with in-flight counts and a slot-availability signal.
Synopsis
- data WorkQueue a
- newWorkQueue :: MonadIO m => m (WorkQueue a)
- pushWork :: MonadUnliftIO m => WorkQueue a -> [a] -> m ()
- popWork :: MonadUnliftIO m => WorkQueue a -> m a
- finishWork :: WorkQueue a -> STM ()
- awaitFinished :: WorkQueue a -> STM ()
- queuedCount :: WorkQueue a -> STM Int
- busyCount :: WorkQueue a -> STM Int
- inFlight :: WorkQueue a -> STM Int
Documentation
The channel, the batches queued on it, the batches a worker holds, and whether a slot freed since the dispatcher last looked.
newWorkQueue :: MonadIO m => m (WorkQueue a)Source #
An empty queue with no busy slots.
pushWork :: MonadUnliftIO m => WorkQueue a -> [a] -> m ()Source #
Enqueue in order.
popWork :: MonadUnliftIO m => WorkQueue a -> m aSource #
Take the next item and transfer its count from queued to busy without interruption.
finishWork :: WorkQueue a -> STM ()Source #
Free the busy slot a popWork took and signal the dispatcher.
awaitFinished :: WorkQueue a -> STM ()Source #
Block until a slot freed, consuming the signal.