HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

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.