CK_PR_NEG(3)
π ck_pr_neg β atomic negation operations β¨
okay so bestie, welcome to the ck_pr_neg(3) page, part of the Concurrency Kit family π«Ά
π NAME π
ck_pr_neg_ptr, ck_pr_neg_ptr_zero, ck_pr_neg_double, ck_pr_neg_double_zero, ck_pr_neg_char, ck_pr_neg_char_zero, ck_pr_neg_uint, ck_pr_neg_uint_zero, ck_pr_neg_int, ck_pr_neg_int_zero, ck_pr_neg_64, ck_pr_neg_64_zero, ck_pr_neg_32, ck_pr_neg_32_zero, ck_pr_neg_16, ck_pr_neg_16_zero, ck_pr_neg_8, ck_pr_neg_8_zero β atomic negation operations π
like. that's the whole squad. eighteen of them. they negate things. atomically. periodt.
π LIBRARY π
Concurrency Kit (that's libck, linked with -lck) π
β¨ SYNOPSIS β¨
first things first, you gotta bring in the header:
#include <ck_pr.h>
and then here's every single one of the babies, verbatim, no cap:
void
ck_pr_neg_ptr(void *target);
void
ck_pr_neg_ptr_zero(void *target, bool *z);
void
ck_pr_neg_double(double *target);
void
ck_pr_neg_double_zero(double *target, bool *z);
void
ck_pr_neg_char(char *target);
void
ck_pr_neg_char_zero(char *target, bool *z);
void
ck_pr_neg_uint(unsigned int *target);
void
ck_pr_neg_uint_zero(unsigned int *target, bool *z);
void
ck_pr_neg_int(int *target);
void
ck_pr_neg_int_zero(int *target, bool *z);
void
ck_pr_neg_64(uint64_t *target);
void
ck_pr_neg_64_zero(uint64_t *target, bool *z);
void
ck_pr_neg_32(uint32_t *target);
void
ck_pr_neg_32_zero(uint32_t *target, bool *z);
void
ck_pr_neg_16(uint16_t *target);
void
ck_pr_neg_16_zero(uint16_t *target, bool *z);
void
ck_pr_neg_8(uint8_t *target);
void
ck_pr_neg_8_zero(uint8_t *target, bool *z);
π«Ά notice the pattern bestie: one plain version per type, plus a_zerovariant that takes an extrabool *z. that's the whole vibe.
πΈ DESCRIPTION πΈ
okay so the ck_pr_neg(3) family of functions atomically negate the value pointed to by target. π
that's it. that's the description. it flips the sign, and it does it atomically, so no other thread is gonna catch it mid-negation being messy. main character energy only π
β RETURN VALUES β
so the ck_pr_neg_zero functions β the ones with _zero in the name, iykyk β set the value pointed to by z to true if the result of the negation operation was 0. π
if it wasn't 0? they set the pointed-to value to false. simple as that.
π literally: *z is a little "hey, did this land on zero?" flag. obsessed.
π¦ SEE ALSO π¦
go read these next bestie, they're all family:
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_inc(3)ck_pr_dec(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, additional information is available at http://concurrencykit.org/ π
okay that's the whole page, you ate it π this was ck_pr_neg(3) from the Concurrency Kit, dated April 7, 2013 β go negate something atomically, bestie, slay β¨ππ¦
π¦ 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