kazura-queue-0.1.0.4: Fast concurrent queues much inspired by unagi-chan

Safe HaskellNone
LanguageHaskell2010

Control.Concurrent.KazuraQueue

Description

KazuraQueue is the fast queue implementation inspired by unagi-chan.

Synopsis

Documentation

data Queue a Source #

Type of a Queue. a is the type of an item in the Queue.

newQueue :: IO (Queue a) Source #

Create a new empty Queue.

readQueue :: Queue a -> IO a Source #

Read an item from the Queue.

readQueueWithoutMask :: Queue a -> IO a Source #

Non-masked version of readQueue. It is not safe for asynchronous exception.

tryReadQueue :: Queue a -> IO (Maybe a) Source #

Try to read an item from the Queue. It never blocks.

Note: It decreases "length" of Queue even when it returns Nothing. In such case, "length" will be lower than 0.

tryReadQueueWithoutMask :: Queue a -> IO (Maybe a) Source #

Non-masked version of tryReadQueue. It is not safe for asynchronous exception.

writeQueue :: Queue a -> a -> IO () Source #

Write an item to the Queue. The item is evaluated (WHNF) before actual queueing.

writeQueueWithoutMask :: Queue a -> a -> IO () Source #

Non-masked version of writeQueue. It is not safe for asynchronous exception.

lengthQueue :: Queue a -> IO Int Source #

Get the length of the items in the Queue.

Caution: It returns the value which is lower than 0 when the Queue is empty and some threads are waiting for new value.

lengthQueue' :: Queue a -> IO Int Source #

Non-minus version of lengthQueue.