qt_sinc_create(3)

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

πŸ’– 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 existing qt_sinc_t variable, and that variable is the one you pass in as the sinc argument.
  • qt_sinc_create() β€” allocates a brand new qt_sinc_t for 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 🌈

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