HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Modulescheduler-2.0.1.0Haskell2010

Control.Scheduler.Queue

  • 4 types
  • 8 values
  • Packagescheduler-2.0.1.0
  • Exports12
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceQueue.hs

Job queue

12 declarations
valuemkJob :: MonadIO m => ((a -> m ()) -> WorkerId -> m ()) -> m (Job m a)
#
datadata Queue (m :: Type -> Type) a
#

A blocking unbounded queue that keeps the jobs in FIFO order and the results IORefs in reversed

Constructors

  • Queue
    • qQueue :: ![Job m a]
    • qStack :: ![Job m a]
    • qResults :: ![IORef (Maybe a)]
    • qBaton :: !MVar ()
datadata JQueue (m :: Type -> Type) a
#

Constructors

  • JQueue
    • jqQueueRef :: !IORef (Queue m a)
    • jqLock :: !MVar ()
newtypenewtype WorkerId
#

A unique id for the worker in the Scheduler context. It will always be a number from 0 up to, but not including, the number of workers a scheduler has, which in turn can always be determined with numWorkers function.

Constructors

Instances9Bounded, Enum, Eq, Integral, Num, Ord, …
  • Bounded WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Enum WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Eq WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Integral WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Num WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Ord WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Read WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Real WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
  • Show WorkerIdDefined in scheduler-2.0.1.0 · Control.Scheduler.Queue
valuenewJQueue :: MonadIO m => m (JQueue m a)
#
valuepushJQueue :: MonadIO m => JQueue m a -> Job m a -> m ()
#

Pushes an item onto a queue and returns the previous count.

valuepopJQueue :: MonadUnliftIO m => JQueue m a -> m (WorkerId -> m ())
#

Pops an item from the queue. The job returns the total job counts that is still left in the queue

valueclearPendingJQueue :: MonadIO m => JQueue m a -> m ()
#

Clears any jobs that haven't been started yet. Returns the number of jobs that are still in progress and have not been yet been completed.

valuereadResults :: MonadIO m => JQueue m a -> m [a]
#

Extracts all results available up to now, the uncomputed ones are discarded. This also has an affect of resetting the total job count to zero.

valueblockPopJQueue :: MonadIO m => JQueue m a -> m ()
#
valueunblockPopJQueue :: MonadIO m => JQueue m a -> m ()
#