CK_RWCOHORT_INIT(3)
π CK_RWCOHORT_INIT β bestie edition
okay so you wanna know about CK_RWCOHORT_INIT?? it's the whole vibe of initializing an instance of a cohort-based reader-writer lock type β¨ like, this is the glow-up moment where your lock goes from "just some bytes" to "actually a functioning lock." iconic behavior only.
π LIBRARY
it lives in Concurrency Kit, aka libck, and you link it with -lck. that's the whole squad right there π
β¨ SYNOPSIS β¨
#include <ck_rwcohort.h>
CK_RWCOHORT_NEUTRAL_INIT(COHORT_NAME cohort_name, LOCK *lock);
CK_RWCOHORT_RP_INIT(COHORT_NAME cohort_name, LOCK *lock,
unsigned int wait_limit);
CK_RWCOHORT_WP_INIT(COHORT_NAME cohort_name, LOCK *lock,
unsigned int wait_limit);
so there's three flavors, right? neutral, reader-preference (RP), and writer-preference (WP). pick your fighter π«Ά
πΈ DESCRIPTION πΈ
This macro initializes the lock instance pointed to by the lock argument. That's it. That's the job. It's giving "first day of school, fresh notebook, everything is possible" π
π¨ REAL TALK, NO CAP: until a lock instance is initialized using the CK_RWCOHORT_INIT macro, any operations involving it will have undefined behavior. like, undefined undefined. chaos gremlin energy. do NOT touch an uninitialized lock, bestie, it will not be cute ππ
okay now the important lil detail β note that the wait_limit argument should only be used with reader-preference or writer-preference locks. for neutral locks, this argument should be excluded. so don't be out here passing wait_limit to a neutral lock, that's not the move π
and if you are unsure of a value to use for the wait_limit argument?? you should use CK_RWCOHORT_STRATEGY_DEFAULT_LOCAL_WAIT_LIMIT. it's the default for a reason, she's reliable, she ate π
π SEE ALSO
your reading list, bestie, go off:
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)
Additional information available at http://concurrencykit.org/ π
that's the whole page, bestie, you understood it perfectly, main character energy, go initialize some locks responsibly πβ¨
β this was CK_RWCOHORT_INIT(3), dated February 24, 2013, and yeah the manpage is old enough to have its own vibe but she still slays π
π¦ 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