Module

Concurrent.Queue

Package
purescript-concurrent-queues
Repository
slamdata/purescript-concurrent-queues

An unbounded FIFO data structure for concurrent access.

#Queue Source

newtype Queue a

An unbounded Queue fit for concurrent access.

#new Source

new :: forall a. Aff (Queue a)

Creates a new Queue.

#read Source

read :: forall a. Queue a -> Aff a

Reads a value from the queue. Blocks if the queue is empty, and resumes when it has been written to.

#write Source

write :: forall a. Queue a -> a -> Aff Unit

Writes a new value into the queue

#tryRead Source

tryRead :: forall a. Queue a -> Aff (Maybe a)

Attempts to read a value from the queue. Fails with Nothing if the queue is empty.

CAREFUL! This will block if other readers are blocked on the queue.