Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
The AtomicQueue
object implements a queue that can be used from multiple
threads without performing any blocking operations.
- newtype AtomicQueue = AtomicQueue (ManagedPtr AtomicQueue)
- noAtomicQueue :: Maybe AtomicQueue
- data AtomicQueueLengthMethodInfo
- atomicQueueLength :: (HasCallStack, MonadIO m) => AtomicQueue -> m Word32
- atomicQueueNew :: (HasCallStack, MonadIO m) => Word32 -> m AtomicQueue
- data AtomicQueuePeekMethodInfo
- atomicQueuePeek :: (HasCallStack, MonadIO m) => AtomicQueue -> m (Ptr ())
- data AtomicQueuePopMethodInfo
- atomicQueuePop :: (HasCallStack, MonadIO m) => AtomicQueue -> m (Ptr ())
- data AtomicQueuePushMethodInfo
- atomicQueuePush :: (HasCallStack, MonadIO m) => AtomicQueue -> Ptr () -> m ()
- data AtomicQueueRefMethodInfo
- atomicQueueRef :: (HasCallStack, MonadIO m) => AtomicQueue -> m ()
- data AtomicQueueUnrefMethodInfo
- atomicQueueUnref :: (HasCallStack, MonadIO m) => AtomicQueue -> m ()
Exported types
newtype AtomicQueue Source #
Methods
length
data AtomicQueueLengthMethodInfo Source #
((~) * signature (m Word32), MonadIO m) => MethodInfo * AtomicQueueLengthMethodInfo AtomicQueue signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> AtomicQueue |
|
-> m Word32 | Returns: the number of elements in the queue. |
Get the amount of items in the queue.
new
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m AtomicQueue | Returns: a new |
Create a new atomic queue instance. initialSize
will be rounded up to the
nearest power of 2 and used as the initial size of the queue.
peek
data AtomicQueuePeekMethodInfo Source #
((~) * signature (m (Ptr ())), MonadIO m) => MethodInfo * AtomicQueuePeekMethodInfo AtomicQueue signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> AtomicQueue |
|
-> m (Ptr ()) | Returns: the head element of |
Peek the head element of the queue without removing it from the queue.
pop
data AtomicQueuePopMethodInfo Source #
((~) * signature (m (Ptr ())), MonadIO m) => MethodInfo * AtomicQueuePopMethodInfo AtomicQueue signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> AtomicQueue |
|
-> m (Ptr ()) | Returns: the head element of |
Get the head element of the queue.
push
data AtomicQueuePushMethodInfo Source #
((~) * signature (Ptr () -> m ()), MonadIO m) => MethodInfo * AtomicQueuePushMethodInfo AtomicQueue signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> AtomicQueue |
|
-> Ptr () |
|
-> m () |
Append data
to the tail of the queue.
ref
data AtomicQueueRefMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * AtomicQueueRefMethodInfo AtomicQueue signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> AtomicQueue |
|
-> m () |
Increase the refcount of queue
.
unref
data AtomicQueueUnrefMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * AtomicQueueUnrefMethodInfo AtomicQueue signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> AtomicQueue |
|
-> m () |
Unref queue
and free the memory when the refcount reaches 0.