CK_PR_INC(3)
π ck_pr_inc(3) π
okay bestie, gather round π«Ά this is the manual page for the ck_pr_inc(3) family of functions β atomic increment operations β and it lives in Concurrency Kit (libck, link with -lck). it's giving "tiny function, huge responsibility" and honestly? iconic. β¨
πΈ NAME πΈ
say hi to the whole squad, because they all show up to the same party:
ck_pr_inc_ptr,ck_pr_inc_ptr_zero,ck_pr_inc_ptr_is_zerock_pr_inc_double,ck_pr_inc_double_zero,ck_pr_inc_double_is_zerock_pr_inc_char,ck_pr_inc_char_zero,ck_pr_inc_char_is_zerock_pr_inc_uint,ck_pr_inc_uint_zero,ck_pr_inc_uint_is_zerock_pr_inc_int,ck_pr_inc_int_zero,ck_pr_inc_int_is_zerock_pr_inc_64,ck_pr_inc_64_zero,ck_pr_inc_64_is_zerock_pr_inc_32,ck_pr_inc_32_zero,ck_pr_inc_32_is_zerock_pr_inc_16,ck_pr_inc_16_zero,ck_pr_inc_16_is_zerock_pr_inc_8,ck_pr_inc_8_zero,ck_pr_inc_8_is_zero
β¦and what are they? atomic increment operations. that's the whole vibe check. π
π LIBRARY π
Concurrency Kit (libck, -lck) β yes the link flag is literally -lck, don't @ me, that's just how it is. π
β¨ SYNOPSIS β¨
first things first, you gotta pull in the header:
#include <ck_pr.h>
and now, the full roster. every single one, no skips, no cuts π₯
void
ck_pr_inc_ptr(void *target);
void
ck_pr_inc_ptr_zero(void *target, bool *z);
bool
ck_pr_inc_ptr_is_zero(void *target);
void
ck_pr_inc_double(double *target);
void
ck_pr_inc_double_zero(double *target, bool *z);
bool
ck_pr_inc_double_is_zero(double *target);
void
ck_pr_inc_char(char *target);
void
ck_pr_inc_char_zero(char *target, bool *z);
bool
ck_pr_inc_char_is_zero(char *target);
void
ck_pr_inc_uint(unsigned int *target);
void
ck_pr_inc_uint_zero(unsigned int *target, bool *z);
bool
ck_pr_inc_uint_is_zero(unsigned int *target);
void
ck_pr_inc_int(int *target);
void
ck_pr_inc_int_zero(int *target, bool *z);
bool
ck_pr_inc_int_is_zero(int *target);
void
ck_pr_inc_64(uint64_t *target);
void
ck_pr_inc_64_zero(uint64_t *target, bool *z);
bool
ck_pr_inc_64_is_zero(uint64_t *target);
void
ck_pr_inc_32(uint32_t *target);
void
ck_pr_inc_32_zero(uint32_t *target, bool *z);
bool
ck_pr_inc_32_is_zero(uint32_t *target);
void
ck_pr_inc_16(uint16_t *target);
void
ck_pr_inc_16_zero(uint16_t *target, bool *z);
bool
ck_pr_inc_16_is_zero(uint16_t *target);
void
ck_pr_inc_8(uint8_t *target);
void
ck_pr_inc_8_zero(uint8_t *target, bool *z);
bool
ck_pr_inc_8_is_zero(uint8_t *target);
π¦ DESCRIPTION π¦
so the ck_pr_inc(3) family of functions atomically increments the value pointed to by target. that's it. that's the whole thing. every type gets its own flavour, every flavour gets the same energy: bump that number, and bump it atomically, so nobody else can catch you mid-bump. π₯
π RETURN VALUES π
here's where it gets spicy, so listen up bestie πΆοΈ
- the
ck_pr_inc_zerofamily sets the value pointed to byztotrueif the result of the increment operation was0. β¨ - otherwise β meaning the result was not
0β those same functions set the value pointed to byztofalse. π - the
ck_pr_inc_is_zerofamily of functions returntrueif the result of the decrement operation was0, andfalseotherwise. π
ok so real talk, the page says "decrement" in that last bullet even though this whole manpage is about increment. that's literally what the original says, character for character, so I'm keeping it exactly as-is. no cap. not my typo to fix, bestie. π
π SEE ALSO π
go read these next, they're all part of the same friend group π«Ά
ck_pr_fence_load(3)ck_pr_fence_load_depends(3)ck_pr_fence_store(3)ck_pr_fence_memory(3)ck_pr_load(3)ck_pr_store(3)ck_pr_fas(3)ck_pr_faa(3)ck_pr_dec(3)ck_pr_neg(3)ck_pr_not(3)ck_pr_add(3)ck_pr_sub(3)ck_pr_and(3)ck_pr_or(3)ck_pr_xor(3)ck_pr_cas(3)ck_pr_btc(3)ck_pr_bts(3)ck_pr_btr(3)
and if you want even more, there's additional information available at http://concurrencykit.org/ β
mwah π that's the whole page. this one's from Concurrency Kit (libck, -lck), dated April 7, 2013, and it's filed under ck_pr_inc(3). slay, go increment something atomically, you main character ππ
π¦ 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 Samy Al Bahra
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms