CK_PR_FAA(3)
β¨ ck_pr_faa β atomic fetch-and-add operations β¨
okay bestie, gather round, because this is genuinely one of the most iconic little families in all of libck and I need you to be seated for it π
π LIBRARY
Concurrency Kit (libck, -lck)
like, that's the whole vibe. you link against -lck and you're in. no cap.
π SYNOPSIS
#include <ck_pr.h>
uintptr_t
ck_pr_faa_ptr(void *target, uintptr_t delta);
double
ck_pr_faa_double(double *target, double delta);
char
ck_pr_faa_char(char *target, char delta);
unsigned int
ck_pr_faa_uint(unsigned int *target, unsigned int delta);
int
ck_pr_faa_int(int *target, int delta);
uint64_t
ck_pr_faa_64(uint64_t *target, uint64_t delta);
uint32_t
ck_pr_faa_32(uint32_t *target, uint32_t delta);
uint16_t
ck_pr_faa_16(uint16_t *target, uint16_t delta);
uint8_t
ck_pr_faa_8(uint8_t *target, uint8_t delta);
nine functions. nine little main characters. each one for a different type. it's giving "we have options and we are not sorry" π
π¦ DESCRIPTION
so the ck_pr_faa(3) family of functions atomically fetches the value pointed to by target and adds the value specified by delta to the value pointed to by target.
that's it. that's the whole thing. atomic fetch-and-add. the fetch and the add are one indivisible moment β nobody can sneak in between them, no other thread gets to peek at some awkward in-between state, it just happens. it's giving β¨seamlessβ¨.
iykyk π
πΈ RETURN VALUES
this function returns the value pointed to by target at the time of operation invocation β before the addition operation is applied.
so like. heads up bestie. you get the old value back. the value from before. the add already happened by the time you're holding your return value, but what you're holding is the past. it's giving time traveler π°οΈβ¨
π₯ SEE ALSO
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_inc(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)
Additional information available at http://concurrencykit.org/ π
okay so real talk, go read the whole little family. they all hang out together and they're all obsessed with each other. the fences, the loads, the stores, the bit twiddlers β it's a whole friend group and you're invited π«Ά
that's the page bestie!! π this was ck_pr_faa(3), brought to you by the April 7, 2013 girlies, and yes that date is iconic, and yes it's still serving. periodt πβ¨π¦πΈπ
π¦ 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