CK_RWCOHORT_INSTANCE(3)
π NAME π
CK_RWCOHORT_INSTANCE β bestie, this is the macro that actually declares an instance of a cohort-based reader-writer lock type. like, the prototype was the vibe, this is the real thing β¨
π LIBRARY π
Concurrency Kit (libck, link it with -lck) π«Ά
β¨ SYNOPSIS β¨
#include <ck_cohort.h>
CK_RWCOHORT_NEUTRAL_INSTANCE(COHORT_NAME cohort_name);
CK_RWCOHORT_RP_INSTANCE(COHORT_NAME cohort_name);
CK_RWCOHORT_WP_INSTANCE(COHORT_NAME cohort_name);
πΈ DESCRIPTION πΈ
okay so listen. once you've defined a lock type with the CK_RWCOHORT_PROTOTYPE(3) macro, you still don't have an actual lock yet. that's just the blueprint, the concept, the mood board π
. To get a real, live, usable instance of your lock type, you must use this macro. no cap.
And the cohort_name you pass in has to be the exact same name you used in the prototype macro. like, they have to match, fr fr β mismatched names are not it.
So for example, if CK_RWCOHORT_PROTOTYPE got called with the name "foo", then your CK_RWCOHORT_INSTANCE call looks like this:
CK_RWCOHORT_INSTANCE(foo) cohort;
and boom, you have a cohort π
This macro is also the one you reach for when you're allocating memory for cohorts. not me being the malloc bestie too π. Say you want to allocate a block of 4 cohorts:
CK_RWCOHORT_WP_INSTANCE(foo) *cohorts = malloc(4 *
sizeof(CK_RWCOHORT_WP_INSTANCE(foo)));
see how the same macro shows up on both sides? that's the way that it has to be. it's giving consistency, it's giving iconic π¦
π SEE ALSO π
ck_rwcohort(3)CK_RWCOHORT_PROTOTYPE(3)CK_RWCOHORT_TRYLOCK_PROTOTYPE(3)CK_RWCOHORT_INSTANCE(3)CK_RWCOHORT_INITIALIZER(3)CK_RWCOHORT_LOCK(3)CK_RWCOHORT_UNLOCK(3)CK_RWCOHORT_LOCKED(3)CK_RWCOHORT_TRYLOCK(3)
More info is available at http://concurrencykit.org/ π
and that's the whole page, bestie!! this one's from February 24, 2013. and it lives in section CK_RWCOHORT_INSTANCE(3) β go declare some instances, you've got this ππ§β
π¦ where this page comes from
- alpine 3.24: ck-doc 0.7.2-r1 Β· BSD-2-Clause AND Apache-2.0
- debian bookworm: libck-dev 0.7.1-10 Β· BSD-2-Clause
- debian trixie: libck-dev 0.7.2-6 Β· BSD-2-Clause
- epel 10: ck-devel 0.7.2-1.el10_1 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- epel 9: ck-devel 0.7.0-10.el9 Β· BSD
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- nixos 26.05: ck 0.7.2
- nixpkgs unstable: ck 0.7.2
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- ubuntu jammy: libck-dev 0.7.1-6ubuntu2 Β· BSD-2-Clause
- ubuntu noble: libck-dev 0.7.1-13build1 Β· BSD-2-Clause
- ubuntu questing: libck-dev 0.7.2-5ubuntu1
- ubuntu resolute: libck-dev 0.7.2-5ubuntu2 Β· BSD-2-Clause
- ubuntu stonking: libck-dev 0.7.2-11 Β· BSD-2-Clause
- Copyright 2013 Brendon Scheinman
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms