CK_COHORT_INIT(3)
β¨ NAME β¨
CK_COHORT_INIT β bestie, this is the one that initializes an instance of a cohort type π
π LIBRARY π
Concurrency Kit (that's libck, and you link it with -lck) π«Ά
πΈ SYNOPSIS πΈ
#include <ck_cohort.h>
CK_COHORT_INIT(COHORT_NAME cohort_name, COHORT *cohort,
void *global_lock, void *local_lock, unsigned int pass_limit);
π DESCRIPTION π
okay so listen, this one is important important. until you've actually initialized a cohort instance with the CK_COHORT_INIT macro, any operations involving it will have undefined behavior. like. not "oh it'll probably be fine" undefined behavior. the real kind. π do not skip this step, bestie, i am begging.
once you do call this macro tho? slay. the cohort pointed to by the cohort argument will use the lock pointed to by global_lock as its global lock, and the lock pointed to by local_lock as its local lock. iconic. exactly what you'd expect. β¨
now here's the juicy part π β the cohort will relinquish its global lock after pass_limit consecutive acquisitions of its local lock, even if there are other threads waiting. like it just lets go. on purpose. that's the whole vibe. that's the design.
and if you're sitting there like "um what number do i put for pass_limit" π β no worries, if you are unsure of a value to use for the pass_limit argument, you should use CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT. it's literally right there for you. use it. π
fr fr: forgetting to init = undefined behavior. initializing = everything works. the choice is yours but it's not really a choice. π
π SEE ALSO π
ck_cohort(3)CK_COHORT_PROTOTYPE(3)CK_COHORT_TRYLOCK_PROTOTYPE(3)CK_COHORT_INSTANCE(3)CK_COHORT_INITIALIZER(3)CK_COHORT_LOCK(3)CK_COHORT_UNLOCK(3)CK_COHORT_LOCKED(3)CK_COHORT_TRYLOCK(3)
Additional information available at http://concurrencykit.org/ π
and that's the whole page, bestie!! this lil baddie is dated February 24, 2013, it lives in section 3 of the manual as CK_COHORT_INIT(3), and it comes to you straight from Concurrency Kit. mwah πβ¨
π¦ 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