Module

Concurrent.BoundedQueue.Sync

Package
purescript-concurrent-queues
Repository
purescript-contrib/purescript-concurrent-queues

#new Source

new :: forall a. Int -> Effect (BoundedQueue a)

Synchronously creates a new BoundedQueue with the given capacity.

#isEmpty Source

isEmpty :: forall a. BoundedQueue a -> Effect Boolean

Synchronously checks whether the given queue is empty. Never blocks.

#tryRead Source

tryRead :: forall a. BoundedQueue a -> Effect (Maybe a)

Synchronously attempts to read an element from the given queue. If the queue is empty, or there is a concurrent reader, returns Nothing.

#tryWrite Source

tryWrite :: forall a. BoundedQueue a -> a -> Effect Boolean

Attempts to write an element into the given queue. If the queue is full, or there is a concurrent writer, returns false otherwise true.

Re-exports from Concurrent.BoundedQueue.Internal

#BoundedQueue Source

newtype BoundedQueue a