HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulelockfree-queue-0.2.4Haskell2010

Data.Concurrent.Queue.MichaelScott

Michael and Scott lock-free, single-ended queues.

This is a straightforward implementation of classic Michael & Scott Queues. Pseudocode for this algorithm can be found here:

http://www.cs.rochester.edu/research/synchronization/pseudocode/queues.html

  • 1 type
  • 4 values
valuenullQ :: LinkedQueue a -> IO Bool
#

Is the queue currently empty? Beware that this can be a highly transient state.

valuepushL :: LinkedQueue a -> a -> IO ()
#

Push a new element onto the queue. Because the queue can grow, this always succeeds.

valuetryPopR :: LinkedQueue a -> IO (Maybe a)
#

Attempt to pop an element from the queue if one is available. tryPop will return semi-promptly (depending on contention), but will return Nothing if the queue is empty.