CK_PR_FENCE_STORE_LOAD(3)
π CK_PR_FENCE_STORE_LOAD(3) π
okay bestie, gather round, we're talking about ck_pr_fence_store_load β a lil function from the CK_PR_FENCE_STORE_LOAD(3) manual page that makes your stores and your loads stop fighting over who goes first. it's giving traffic cop energy fr fr π¦β¨
π NAME π
ck_pr_fence_store_load β enforce ordering of store operations to load operations. that's it, that's the whole job, and she does it flawlessly π
π LIBRARY π
Concurrency Kit</purl> β link it with libck, so like -lck. yes that's the flag, write it down π
β¨ SYNOPSIS β¨
#include <ck_pr.h>
void
ck_pr_fence_store_load(void);
void
ck_pr_fence_strict_store_load(void);
two functions, same vibe, both just sitting there with no arguments. iconic honestly π
π« DESCRIPTION π«
okay so here's the tea, bestie π΅. The ck_pr_fence_store_load() function enforces the ordering of any memory store, ck_pr_store() and atomic read-modify-write operations to load operations relative to the invocation of the function. translation: everything that writes has to be done being all write-y before the stuff that reads gets to go. no cutting the line. no cap π«
this function always serves as an implicit compiler barrier. so the compiler is not gonna get cute and reorder things behind your back, periodt.
and listen β a fence will currently always be emitted for this operation, including for TSO memory model targets. so like, even on the architectures where you might be like "surely this is a no-op", nope, fence is getting emitted. every time. she shows up to work πΈ
π EXAMPLE π
#include <ck_pr.h>
static int a = 0;
static int b = 0;
void
function(void)
{
unsigned int snapshot_b;
ck_pr_store_int(&a, 1);
/*
* Guarantee that the store to a is completed
* with respect to load from b.
*/
ck_pr_fence_store_load();
snapshot_b = ck_pr_load_int(&b, 2);
return;
}
see how the fence is chilling between the store and the load? that's the whole point π«Ά the store to a is guaranteed to be completed with respect to the load from b. the comment says it, the code does it, we love a self-aware snippet π
π₯ RETURN VALUES π₯
This function has no return value. she gives you nothing back and honestly? that's fine, her job was the ordering π
π SEE ALSO π
ck_pr_stall(3)ck_pr_fence_atomic(3)ck_pr_fence_atomic_store(3)ck_pr_fence_atomic_load(3)ck_pr_fence_load(3)ck_pr_fence_load_atomic(3)ck_pr_fence_load_store(3)ck_pr_fence_load_depends(3)ck_pr_fence_store(3)ck_pr_fence_store_atomic(3)ck_pr_fence_memory(3)ck_pr_barrier(3)ck_pr_fas(3)ck_pr_load(3)ck_pr_store(3)ck_pr_faa(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/ β go peek, it's a whole website, very demure π
okay that's the page!! this was the CK_PR_FENCE_STORE_LOAD(3) man page, dated May 18, 2013, and this particular glow-up was served to you by the source CK_PR_FENCE_STORE_LOAD(3) (yes she contains herself, it's very meta, we don't question it) π mwah, go write some correctly-ordered memory ops, bestie, i believe in you π§β¨
π¦ 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