CK_RING_CAPACITY(3)
π CK_RING_CAPACITY π
okay bestie, so this is a page from the Concurrency Kit manual β yeah, the libck one, linked with -lck π β and it's about ck_ring_capacity(3), which is genuinely the shortest little baddie in the whole ring-buffer friend group. lowkey iconic for how much it doesn't do. let's get into it β¨
πΈ NAME πΈ
ck_ring_capacity β returns the number of pointer slots in a bounded FIFO π¦
π LIBRARY π
Concurrency Kit (that's libck, and you link it with -lck π
)
β¨ SYNOPSIS β¨
#include <ck_ring.h>
unsigned int
ck_ring_capacity(ck_ring_t *ring);
π DESCRIPTION π
so like. the ck_ring_capacity(3) function returns the number of pointers that can be held in the buffer pointed to by ring. that's it. that's the whole job. she's a one-trick pony and she ate π«Ά
but bestie, here's the tea you actually need to know π β a ring can only hold ck_ring_capacity(3) minus one entries at a time. so if capacity says 16, you get 15 slots to play with. the last one is likeβ¦ reserved. it's giving "plus one who isn't actually invited". don't forget the minus one, fr fr, because that's the exact thing that will have you debugging at 3am wondering why your enqueue is failing when there's obviously room π
β οΈ note it: ck_ring_capacity(3) minus one. that's your real usable count. periodt.
π SEE ALSO π
ck_ring_init(3)ck_ring_enqueue_spmc(3)ck_ring_dequeue_spmc(3)ck_ring_trydequeue_spmc(3)ck_ring_enqueue_spmc_size(3)ck_ring_dequeue_spsc(3)ck_ring_enqueue_spsc(3)ck_ring_enqueue_spsc_size(3)ck_ring_size(3)
Additional information available at http://concurrencykit.org/ π
and that's the whole page, bestie, short and sweet like a good text back π this was CK_RING_CAPACITY(3) from the Concurrency Kit, dated April 20, 2013 β old but still slaying, no cap. go forth and size your rings correctly β¨π
π¦
π¦ 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 2012-2013 Samy Al Bahra
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms