qthread_syncvar_writeEF(3)
π NAME π
qthread_syncvar_writeEF, qthread_syncvar_writeEF_const β bestie, these ones wait for the dest syncvar to be empty, and then they fill it π
(they live in libqthread, in case you were wondering π¦)
πΈ SYNOPSIS πΈ
#include <qthread.h>
int
qthread_syncvar_writeEF (syncvar_t * restrict dest, const uint64_t *
restrict src);
int
qthread_writeEF_const (syncvar_t *dest, uint64_t src);
β¨ DESCRIPTION β¨
okay so here's the vibe: these functions wait for the dest syncvar to become empty, and then they fill it. that's it, that's the whole personality π«Ά
and when dest does finally go empty? only one thread that's blocked like this gets awoken. not two, not the whole group chat. one. no cap.
data is read from src and written to dest. and lowkey important: the data in src MUST be small enough to fit in the syncvar_t. it's giving "measure twice, write once" π
the semantics of writeEF are, in order, bestie:
dest's FEB state must be"empty"- data is copied from
srctodest dest's FEB state gets changed from"empty"to"full"
periodt. π
π RETURN VALUE π
on success: the memory address dest is marked full, the address dest is filled with the contents of src, and 0 (QTHREAD_SUCCESS) is returned. slay β¨
on error: a non-zero error code comes back at you. not slay. π
π ERRORS π
ENOMEMβ not enough memory could be allocated for bookkeeping structures (when blocking). the bookkeeping said "no thoughts, head empty" πEOVERFLOWβ the value specified insrccould not be stored in thesyncvar_t. on most platforms,syncvar_tcan only store 60 bits of data, despite occupying 64 bits of memory, because four bits are reserved for status information. so yeah, it's a 64-bit outfit with only 60 bits of pocket space π«QTHREAD_TIMEOUTβ could not obtain the lock on thesyncvar_t's status bits. this may be caused by many things, including memory corruption, invalid syncvar, or even absurdly excessive contention (because its protected by a naive spinlock rather than a fair spinlock). so basically: it could be a little oopsie or it could be the whole thing falling apart π¨
π₯ SEE ALSO π₯
qthread_syncvar_empty(3)qthread_syncvar_fill(3)qthread_syncvar_writeF(3)qthread_syncvar_readFF(3)qthread_syncvar_readFE(3)qthread_syncvar_status(3)
libqthread Β· APRIL 2011 Β· qthread_syncvar_writeEF(3)
and that's the whole page, bestie π go forth and fill your syncvars, stay hydrated, and remember: only one thread gets woken up, so don't be weird about it π§β¨
π¦ 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