qthread_syncvar_empty/fill(3)

πŸ“¦ version 1.22^20251007gitcedb1fc, in fedora 43, fedora 44

πŸ’– NAME πŸ’–

ok so bestie, meet qthread_syncvar_empty and qthread_syncvar_fill β€” they're the duo that sets the given syncvar to either "empty" or "full". that's it. that's the whole job. πŸ’…

and jsyk this is all from libqthread, the qthread_syncvar_empty/fill(3) page, so like. you're in the right place. 🫢


✨ SYNOPSIS ✨

#include <qthread.h>

int
qthread_syncvar_empty (syncvar_t *dest);

int
qthread_syncvar_fill (syncvar_t *dest);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” qthread_syncvar_empty() and qthread_syncvar_fill() assert the empty or full state of the given dest addresses. like, they just declare it. manifesting, but for syncvars. ✨

and the key thing, bestie, the part that's giving no waiting around: they do not wait for the addresses to be in any particular state. not even a little. not even a millisecond of "hmm let me check again". they say what they say and they move on. periodt. πŸ’…


πŸ’œ RETURN VALUE πŸ’œ

  • On success, the full/empty bits are modified and 0 is returned. πŸŽ€ slay.
  • On error, a non-zero error code is returned. 😭 not slay.

πŸ”₯ ERRORS πŸ”₯

  • QTHREAD_TIMEOUT β€” could not obtain the lock on the syncvar_t's status bits. bestie this one can happen for so many reasons and honestly some of them are unhinged:
    • memory corruption πŸ’€
    • an invalid syncvar πŸ™ˆ
    • or even just absurdly excessive contention β€” and yeah, that last one is because it's protected by a naive spinlock rather than a fair spinlock. not me getting bodied by a spinlock's whole personality 😭

🌸 SEE ALSO 🌸


libqthread Β· APRIL 2011 β€” okay that's the whole page bestie, mwah πŸ’‹ go forth and set those syncvars, you absolute icon πŸ‘‘βœ¨πŸŒˆ

πŸ“¦ where this page comes from