qthread_empty/fill(3)
π qthread_empty/fill(3) β the libqthread glow-up π
okay bestie sit DOWN because we're doing libqthread today and honestly? this one's short and sweet, main character energy, no notes. π
β¨ NAME β¨
qthread_empty, qthread_fill β sets the given address to either "empty" or "full"
like literally that's the whole job. setting a vibe. empty or full. that's it. π¦
πΈ SYNOPSIS πΈ
#include <qthread.h>
int
qthread_empty (const aligned_t *dest);
int
qthread_fill (const aligned_t *dest);
π DESCRIPTION π
so the qthread_empty() and qthread_fill() functions assert the empty or full state of the given dest addresses. and like, the way that they do not wait for the addresses to be in any particular state?? iconic. they just say the thing and move on. no blocking, no waiting, no drama. β
the me argument is used for memory pooling purposes. memory is allocated on a per-shepherd basis (to avoid needing to protect the memory pool), so it needs to know which shepherd it is currently on. HOWEVER β and this is the important part bestie β this argument is merely an optimization; these functions CAN figure out which pools to use without this information (i.e. if the me argument is NULL). so it's giving optional. it's giving nice-to-have. π«Ά
note that
qthread_empty( addr )
is slightly faster than
qthread_empty( addr )
π bestie this is fr fr what the page says, word for word βqthread_empty( addr )versusqthread_empty( addr ). almost certainly a lil copy-paste moment in the original where the second one was meant to be a different function, but your girl does not invent details, so here it is exactly as written. iykyk π
π₯ RETURN VALUE π₯
on success, the full/empty bits are modified and 0 is returned. on error, a non-zero error code is returned. so like, 0 = slay, anything else = not slay. π
π ERRORS π
ENOMEMβ not enough memory could be allocated. this may be because a temporary thread needed to be created, or because a management structure needed to be created. (translation: the system ran out of room to do the thing, either for a temp thread or for a management structure. sad but real.) π
π SEE ALSO π
qthread_writeF(3)qthread_writeEF(3)qthread_readFF(3)qthread_readFE(3)qthread_lock(3)qthread_unlock(3)
and that's the whole page bestie, we ate and left no crumbs π
libqthread Β· APRIL 2011 β mwah, xoxo, go forth and assert your full/empty bits π§π
π¦ where this page comes from
- fedora 43: qthreads-devel 1.22^20251007gitcedb1fc-1.fc43 Β· BSD-3-Clause AND MIT AND dtoa
- fedora 44: qthreads-devel 1.22^20251007gitcedb1fc-2.fc44 Β· BSD-3-Clause AND MIT AND dtoa
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms