[vlc-devel] [PATCH 3/4] queue: add generic queue/FIFO helpers

Rémi Denis-Courmont remi at remlab.net
Sat Apr 11 21:44:24 CEST 2020


Le lauantaina 11. huhtikuuta 2020, 21.41.05 EEST Rémi Denis-Courmont a écrit :
> +/**
> + * Thread-safe queue (a.k.a. FIFO).
> + */
> +typedef struct vlc_queue
> +{
> +    struct vlc_queue_entry *first;
> +    struct vlc_queue_entry **lastp;
> +    vlc_mutex_t lock;
> +    vlc_cond_t wait;
> +} vlc_queue_t;

> +VLC_API void *vlc_queue_Dequeue(vlc_queue_t *, ptrdiff_t offset)
> +VLC_USED;

It's also possible to store the offset in vlc_queue_t and pass it only to 
vlc_queue_Init(). Trade-off between usability and memory use.

-- 
Rémi Denis-Courmont
Hagalund ny stad, Nylands republik





More information about the vlc-devel mailing list