Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::packet::ConcurrentQueue Class Reference

Concurrent blocking packet queue. More...

#include <concurrent_queue.h>

Inheritance diagram for roc::packet::ConcurrentQueue:
Collaboration diagram for roc::packet::ConcurrentQueue:

Public Types

enum  Mode { Blocking , NonBlocking }
 Queue mode. More...
 

Public Member Functions

 ConcurrentQueue (Mode mode)
 Initialize. mode defines whether reads will be blocking. More...
 
virtual ROC_ATTR_NODISCARD status::StatusCode read (PacketPtr &)
 Read next packet. If reads are not concurrent, and queue is non-blocking, then reads are wait-free. Otherwise they may block. More...
 
virtual ROC_ATTR_NODISCARD status::StatusCode write (const PacketPtr &packet)
 Add packet to the queue. Wait-free operation. More...
 

Detailed Description

Concurrent blocking packet queue.

Definition at line 28 of file concurrent_queue.h.

Member Enumeration Documentation

◆ Mode

Queue mode.

Enumerator
Blocking 

Read operation blocks until queue is non-empty.

NonBlocking 

Read operation returns null if queue is empty.

Definition at line 31 of file concurrent_queue.h.

Constructor & Destructor Documentation

◆ ConcurrentQueue()

roc::packet::ConcurrentQueue::ConcurrentQueue ( Mode  mode)
explicit

Initialize. mode defines whether reads will be blocking.

Member Function Documentation

◆ read()

virtual ROC_ATTR_NODISCARD status::StatusCode roc::packet::ConcurrentQueue::read ( PacketPtr )
virtual

Read next packet. If reads are not concurrent, and queue is non-blocking, then reads are wait-free. Otherwise they may block.

See also
Mode.

Implements roc::packet::IReader.

◆ write()

virtual ROC_ATTR_NODISCARD status::StatusCode roc::packet::ConcurrentQueue::write ( const PacketPtr packet)
virtual

Add packet to the queue. Wait-free operation.

Implements roc::packet::IWriter.


The documentation for this class was generated from the following file: