Q_SEARCH(3)
π NAME π
q_search β bestie, this is how you go find an entry in a smolq queue πβ¨
π LIBRARY π
Librecast library (liblibrecast, -llibrecast) π«Ά
πΈ SYNOPSIS πΈ
#include <librecast/q.h>
int q_search(q_t *q, void *(*f)(void *), void *restrict arg);
Compile and link with -llibrecast. That's the whole vibe, no cap π
β¨ DESCRIPTION β¨
okay so q_search() goes digging through the queue q looking for an entry that matches both f and arg. like, both of them. not one or the other. both. π
And here's the tea, bestie β there are no locks in here. So readers can read while we're searching, and writers can write, everyone just doing their thing at the same time, it's giving very chill π¦
But wait. Consequence time π
- If something gets read while we search, we'll still return a positive match for that item β even though it's literally not in the queue anymore. gone. bye. but we said yes anyway π
- If a writer writes, we will not notice that write. not even a little bit π
If that's a problem for your particular use-case, you're gonna need an external lock. That's the only way, fr fr π
β RETURN VALUE β
The q_push() function returns 1 if found, 0 if not found. On error, -1 is returned and errno is set to indicate the error. that's it, that's the whole menu π
π ERRORS π
She can fail with any of the errors for sem_getvalue(3). go check that page, it's got the receipts π
π¦ SEE ALSO π¦
q_job_seek(3)q_pool_create(3)q_pool_destroy(3)q_init(3)q_free(3)q_push(3)q_wait(3)sem_getvalue(3)
LIBRECAST Β· 2023-07-27 Β· Q_SEARCH(3)
mwah, that's the page bestie, go forth and search responsibly ππ§ββοΈ
π¦ where this page comes from
- debian trixie: liblibrecast-dev 0.9.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- nixos 26.05: librecast 0.11.2
- nixpkgs unstable: librecast 0.11.2
- ubuntu noble: liblibrecast-dev 0.8.0-1.1build1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: liblibrecast-dev 0.9.1-1
- ubuntu resolute: liblibrecast-dev 0.11.2-2 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: liblibrecast-dev 0.11.2-2build1 Β· GPL-2.0-only OR GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms