qthread_writeEF(3)
β¨ qthread_writeEF(3) β¨
okay bestie, pull up a chair, we're reading the libqthread manual together and this one is genuinely iconic π«Ά it's the qthread_writeEF page, and yes there's a _const twin, they're a package deal π
πΈ NAME πΈ
qthread_writeEF, qthread_writeEF_const β waits for the dest to be empty, then fills it. that's it. that's the whole vibe. wait for empty, then fill. π
π¦ SYNOPSIS π¦
#include <qthread.h>
int
qthread_writeEF (aligned_t * restrict dest, const aligned_t * restrict
src);
int
qthread_writeEF_const (aligned_t *dest, aligned_t src);
π DESCRIPTION π
so like, these functions wait for memory to become empty, and then fill it. the way that works is: when the memory becomes empty, only one thread that's blocked like this gets awoken. not two, not a crowd, one. main character energy only π
data is read from src and written to dest. simple. slay.
the semantics of writeEF are, in order, no skipping:
dest's FEB state must be"empty"- data is copied from
srctodest dest's FEB state gets changed from"empty"to"full"
periodt. that's the whole pipeline. π
π WARNING π
okay so this is the part where I hold your hand, because it's giving "read this or perish" π
This, and all other FEB-related functions currently operate exclusively on aligned data. This is to simulate the behavior of the MTA as closely as possible. If the library was compiled for a 32-bit architecture, it will require 4-byte alignment and reads/writes will operate on four bytes at a time; if the library was compiled for a 64-bit architecture, it will require 8-byte alignment and reads/writes will operate on eight bytes at a time.
bestie. alignment is not a suggestion here, it's a personality requirement. get it wrong and you're on your own π
β RETURN VALUE β
On success, the memory address dest is marked full, the address dest is filled with the contents of src, and 0 is returned. π
On error, a non-zero error code is returned. that's the "we don't talk about it" branch. π
π ERRORS π
ENOMEMβ Not enough memory could be allocated for bookkeeping structures. lowkey tragic. the bookkeeping could not be booked. π
π§ SEE ALSO π§
qthread_empty(3)qthread_fill(3)qthread_writeF(3)qthread_readFF(3)qthread_readFE(3)qthread_lock(3)qthread_unlock(3)
go read those too, they're all in the same friend group π
and that's the page!! this whole thing came out of libqthread, dated APRIL 2011 β shoutout to the source and the version and the date, they ate and left no crumbs ππ byeeee, go write to your dest responsibly π«Άβ¨
π¦ 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