VLC  4.0.0-dev
Modules | Files | Data Structures | Typedefs | Functions
Collaboration diagram for Thread-safe queues (FIFO):

Modules

 Queue internals
 Low-level queue functions.
 
 Killable queues
 Thread-safe queues with an end flag.
 

Files

file  vlc_queue.h
 

Data Structures

struct  vlc_queue
 Thread-safe queue (a.k.a. More...
 

Typedefs

typedef struct vlc_queue vlc_queue_t
 Thread-safe queue (a.k.a. More...
 

Functions

void vlc_queue_Init (vlc_queue_t *queue, ptrdiff_t next_offset)
 Initializes a queue. More...
 
void vlc_queue_Enqueue (vlc_queue_t *, void *entry)
 Queues an entry. More...
 
void * vlc_queue_Dequeue (vlc_queue_t *)
 Dequeues the oldest entry. More...
 
void * vlc_queue_DequeueAll (vlc_queue_t *)
 Dequeues all entries. More...
 

Detailed Description

Typedef Documentation

◆ vlc_queue_t

typedef struct vlc_queue vlc_queue_t

Thread-safe queue (a.k.a.

FIFO).

Function Documentation

◆ vlc_queue_Dequeue()

void* vlc_queue_Dequeue ( vlc_queue_t )

Dequeues the oldest entry.

This function dequeues an entry from a thread-safe queue. If the queue is empty, it will wait until at least one entry is available.

Parameters
offsetoffset of the next pointer within a queue entry
Returns
the first entry in the queue, or NULL if the queue is empty

References vlc_queue_DequeueUnlocked(), vlc_queue_IsEmpty(), vlc_queue_Lock(), vlc_queue_Unlock(), vlc_queue_Wait(), and vlc_testcancel().

Referenced by vlc_queue_IsEmpty().

◆ vlc_queue_DequeueAll()

void* vlc_queue_DequeueAll ( vlc_queue_t )

Dequeues all entries.

This is equivalent to calling vlc_queue_Dequeue() repeatedly until the queue is emptied. However this function is much faster than that, as it does not need to update the linked-list pointers.

Returns
a linked-list of all entries (possibly NULL if none)

References vlc_queue_DequeueAllUnlocked(), vlc_queue_Lock(), and vlc_queue_Unlock().

Referenced by block_FifoEmpty(), and vlc_queue_IsEmpty().

◆ vlc_queue_Enqueue()

void vlc_queue_Enqueue ( vlc_queue_t ,
void *  entry 
)

Queues an entry.

This function enqueues an entry, or rather a linked-list of entries, in a thread-safe queue.

Parameters
entrylist of entries (if NULL, this function has no effects)

References vlc_queue_EnqueueUnlocked(), vlc_queue_Lock(), and vlc_queue_Unlock().

Referenced by vlc_queue_IsEmpty().

◆ vlc_queue_Init()

void vlc_queue_Init ( vlc_queue_t queue,
ptrdiff_t  next_offset 
)

Initializes a queue.

Parameters
queuestorage space for the queue
next_offsetoffset of the pointer to the next element within a queue entry (as per offsetof())

References vlc_queue::first, vlc_queue::lastp, vlc_queue::lock, vlc_queue::next_offset, vlc_cond_init(), vlc_mutex_init(), and vlc_queue::wait.

Referenced by block_FifoNew(), and vlc_stream_fifo_New().