Q_PUSH(3)
π Q_PUSH(3) β the Librecast Programmer's Manual, bestie edition π
okay so welcome to the Librecast Programmer's Manual, page Q_PUSH(3) πΈ pull up a chair, we're pushing jobs onto queues and it's gonna be iconic.
β¨ NAME β¨
q_push β push a job onto a smolq queue π«Ά
π LIBRARY π
Librecast library (liblibrecast, -llibrecast) π
π SYNOPSIS π
#include <librecast/q.h>
int q_push(q_t *q, void *(*f)(void *), void *restrict arg);
int q_trypush(q_t *q, void *(*f)(void *), void *restrict arg);
Compile and link with -llibrecast. no cap, you gotta have that flag β¨
π DESCRIPTION π
So here's the tea, bestie π:
q_push()pushesfonto the queueqwith argumentarg. That's it. That's the whole vibe. πq_trypush()is literally the same asq_push()except that if the queue writer lock cannot be immediately obtained, then the call returns an error (errnoset toEAGAIN) instead of blocking. she does NOT wait around, she's got places to be π€
Like,q_push()will just stand there patiently until it can get in.q_trypush()is the "if you're not free in 0.2 seconds I'm leaving" friend π
β RETURN VALUE β
- The
q_push()function returns zero on success π - On error,
-1is returned anderrnois set to indicate the error π
π¦ ERRORS π¦
EAGAIN(q_trypush()) β The operation could not be performed without blocking. (i.e., the queue was full). she's FULL full, bestie π
The function can also fail with the errors for sem_post(3) or sem_wait(3). so go read those too, iykyk π§
πΈ SEE ALSO πΈ
q_job_seek(3), q_pool_create(3), q_pool_destroy(3), q_init(3), q_free(3), q_wait(3), sem_post(3), sem_wait(3) β the whole friend group, go say hi π
and that's the page!! this one's from the LIBRECAST era, dated 2023-07-25, filed under Q_PUSH(3) π stay hydrated, read your semaphores, and go push some jobs bestie π«Άβ¨
π¦ 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