CK_COHORT_INSTANCE(3)

πŸ’– CK_COHORT_INSTANCE β€” declare an instance of a cohort type πŸ’–

okay bestie, so this one is short but it's IMPORTANT, like the lil glue that holds ur whole cohort situation together 🫢 we're in the Concurrency Kit zone here (that's libck, link it with -lck ✨)


🌸 SYNOPSIS 🌸

#include <ck_cohort.h>

CK_COHORT_INSTANCE(COHORT_NAME cohort_name);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie β˜• β€” after you've defined a cohort type, you can't just... use it. no ma'am. you gotta declare instances of it first, and CK_COHORT_INSTANCE is literally the macro that does that for you. periodt πŸ’…

like, say you already used the CK_COHORT_PROTOTYPE macro to define a cohort type named foo. to make an actual instance of that type, you'd do:

CK_COHORT_INSTANCE(foo) cohort;

✨ iconic. and guess what β€” you also use this same macro when you're allocating memory for cohorts, so it's giving two-jobs-one-macro energy πŸ‘‘

like if you wanted to allocate a block of 4 cohorts, it'd look like:

CK_COHORT_INSTANCE(foo) *cohorts = malloc(4 *
sizeof(CK_COHORT_INSTANCE(foo)));
fr fr, use the macro inside sizeof too β€” don't try to be clever and hand-roll the type name, bestie, that's not the vibe πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ

go read these next, you're gonna be obsessed:

and there's more lore at http://concurrencykit.org/ 🌈


okay that's the whole page, no cap. this is the Concurrency Kit version, so like, go read the other ones too, they're all linked above πŸŽ€ and this was dated February 24, 2013. β€” yes it's an old queen but she still slays πŸ’– stay safe out there, bestie, and remember: declare ur instances before u use em, mwah πŸ˜˜πŸ’…

πŸ“¦ where this page comes from