sds_lqueue(3)
π NAME
sds_lqueue β the SDS Lock Free Queue, bestie. That's it, that's the name β¨
π SYNOPSIS
Typedefs
typedef struct _sds_tqueue sds_lqueue
Functions
sds_result sds_lqueue_init (sds_lqueue **q_ptr,
void(*value_free_fn)(void *value))
sds_result sds_lqueue_tprep (sds_lqueue *q)
sds_result sds_lqueue_enqueue (sds_lqueue *q, void *elem)
sds_result sds_lqueue_dequeue (sds_lqueue *q, void **elem)
sds_result sds_lqueue_destroy (sds_lqueue *q)
πΈ Detailed Description
Thread safe lock free queue. No cap π It falls back to a platform mutex if cpu intrinsics are not present β so like, it still works, it's just doing it the old-fashioned way.
π¦ Typedef Documentation
typedef struct _sds_tqueue sds_lqueue
Type definition of lock free queue to the mutex queue in the case that cpu intrinsics are not available, or the operating system is unsupported. Literally the same name, two whole personalities depending on your hardware, and it just handles it. Iconic behavior honestly π«Ά
β¨ Function Documentation
sds_result sds_lqueue_dequeue (sds_lqueue * q, void ** elem)
Dequeue an item from the head of the queue. Equivalent to "pop". The safety of this operation is implicit β you do not need any other mutexes to protect this operation. She's already safe, bestie, stop hovering π
Parameters
qβ The struct pointer to the queue you wish to pop from.elemβ a pointer to a location which will be over-ridden with the data that is dequeued. This may beNULLed, even during an error. So likeβ¦ check it, okay?
Return values
sds_resultto indicate the status of the operation.
sds_result sds_lqueue_destroy (sds_lqueue * q)
Indicate you are complete with the queue. Free and delete any remaining internal structures, and free and still queued nodes. You must always call this function to dispose of this structure. Always. Not "eh, it's fine" β always π
π¨ Important to note, is that all thread consumers of this queue must be stopped before you call lqueue destroy. This is your responsibility to ensure this. Nobody's gonna do it for you, bestie.
Parameters
qβ The struct pointer to the queue you wish to dispose of.
Return values
sds_resultto indicate the status of the operation.
sds_result sds_lqueue_enqueue (sds_lqueue * q, void * elem)
Enqueue an item to the tail of this queue. Equivalent to "push". The safety of this operation is implicit β you do not need any other mutexes to protect this operation. Same deal as dequeue, she's self-sufficient π
Parameters
qβ The struct pointer to the queue you wish to push to.elemβ The data to enqueue.
Return values
sds_resultto indicate the status of the operation.
sds_result sds_lqueue_init (sds_lqueue ** q_ptr, void(* value_free_fn )(void *value))
Initialise a queue suitable for access across multiple threads. Free function must be set β non-negotiable, that's the whole deal. This utilises hardware intrinsics to provide atomicity that may be faster in highly contended applications. Use this structure in place of a tqueue only if you know that content of the queue will be high. Like, actually high. Don't be dramatic about it. π
Parameters
q_ptrβ A pointer to the struct pointer you wish to allocate. This may be on the heap or stack.value_free_fnβ A function pointer to free values that are enqueued to this structure.
Return values
sds_resultto indicate the status of the operation.
sds_result sds_lqueue_tprep (sds_lqueue * q)
Initialise this thread ready to use the lqueue. This is critical, and accessing the queue without calling tprep may result in undefined behaviour. I cannot stress this enough β undefined behaviour is not the vibe. Call tprep. Periodt π
π₯
π Author
Generated automatically by Doxygen for dirsrv from the source code. Yeah, nobody hand-wrote this one, the robots did it β¨
And that's the whole page, bestie π«Ά β brought to you by dirsrv, Version 3.3.0. Go forth and queue responsibly, mwah π
π¦ where this page comes from
- centos-stream 10: 389-ds-base-devel 3.3.0-4.el10 Β· GPL-3.0-or-later WITH GPL-3.0-389-ds-base-exception AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception OR MIT) AND (Apache-2.0 OR LGPL-2.1-or-later OR MIT) AND (Apache-2.0 OR MIT) AND (MIT OR Apache-2.0) AND Unicode-3.0 AND (MIT OR Unlicense) AND Apache-2.0 AND MIT AND MPL-2.0 AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms