qt_sinc_create(3)
π qt_sinc_create β bestie edition π
okay so this is a page from the libqthread manual, section 3, and it's all about qt_sinc_create β literally the moment a sinc gets born. let's get into it π«Ά
β¨ NAME β¨
qt_sinc_create β allocate and/or initialize a sinc π
πΈ SYNOPSIS πΈ
#include <qthread/sinc.h>
qt_sinc_t *
qt_sinc_create (size_t sizeof_value,
const void *initial_value,
qt_sinc_op_f op,
size_t expect);
void
qt_sinc_init (qt_sinc_t *restrict sinc,
size_t sizeof_value,
const void *initial_value,
qt_sinc_op_f op,
size_t expect);
π¦ DESCRIPTION π¦
okay so these two functions are the glow-up station for a qt_sinc_t object β they allocate it and/or initialize it, and get it all ready to do reduction operations. no cap.
The sinc gets initialized to receive expect submissions. and bestie, those submissions can come from different tasks or from the same task β it does not care, it's not judgy, it's giving inclusive energy β¨
Each submission can also carry a value of size sizeof_value (peep the qt_sinc_submit() man page for that whole situation π). All those submitted values get reduced down into a single value using the function op, and the initial value they get reduced into is the sizeof_value bytes sitting at the address that initial_value points to. iconic.
so the difference between the two:
qt_sinc_init()β initializes an existingqt_sinc_tvariable, and that variable is the one you pass in as thesincargument.qt_sinc_create()β allocates a brand newqt_sinc_tfor you. main character energy, fresh out the box π
Now about that op argument β it must be a function pointer with a qt_sinc_op_f prototype, like this:
void op (void *target, void *src);
and the function has to read sizeof_value bytes out of the src and target arguments, do whatever reduction operation it needs to do, and store the result into, at most, sizeof_value bytes at the target address. periodt.
π RETURN VALUES π
Returns an initialized qt_sinc_t object. slay. π₯³
π SEE ALSO π
qt_sinc_destroy(3)qt_sinc_expect(3)qt_sinc_fini(3)qt_sinc_reset(3)qt_sinc_submit(3)qt_sinc_wait(3)
go read those next, iykyk π
okay that's the whole page!! this one's from libqthread, and it was dated AUGUST 2012 β vintage, honestly, we love an older queen π thanks for reading bestie, mwah ππ
π¦ 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