1CK_PR_FENCE_LOAD_STOR... BSD Library Functions Manual CK_PR_FENCE_LOAD_STOR...
2
4 ck_pr_fence_load_store — enforce ordering of load operations to store
5 operations
6
8 Concurrency Kit (libck, -lck)
9
11 #include <ck_pr.h>
12
13 void
14 ck_pr_fence_load_store(void);
15
16 void
17 ck_pr_fence_strict_load_store(void);
18
20 This function enforces the ordering of any memory load and ck_pr_load(3)
21 operations with respect to store operations relative to the invocation of
22 the function. Any store operations that were committed on remote proces‐
23 sors and received by the calling processor before the invocation of
24 ck_pr_fence_load_store() is also be made visible only after a call to the
25 ck_pr_fence_load family of functions. This function always serves as an
26 implicit compiler barrier. On architectures with CK_MD_TSO or CK_MD_PSO
27 specified (total store ordering and partial store ordering respectively),
28 this operation only serves as a compiler barrier and no fence instruc‐
29 tions will be emitted. To force the unconditional emission of a load
30 fence, use ck_pr_fence_strict_load_store(). Architectures implementing
31 CK_MD_RMO always emit a fence.
32
34 #include <ck_pr.h>
35
36 static unsigned int a;
37 static unsigned int b;
38
39 void
40 function(void)
41 {
42 unsigned int snapshot_a;
43
44 snapshot_a = ck_pr_load_uint(&a);
45
46 /*
47 * Guarantee that the load from "a" completes
48 * before the store to "b".
49 */
50 ck_pr_fence_load_store();
51 ck_pr_store_uint(&b, 1);
52
53 return;
54 }
55
57 This function has no return value.
58
60 ck_pr_stall(3), ck_pr_fence_atomic(3), ck_pr_fence_atomic_store(3),
61 ck_pr_fence_atomic_load(3), ck_pr_fence_load_depends(3),
62 ck_pr_fence_load_atomic(3), ck_pr_fence_store(3), ck_pr_fence_memory(3),
63 ck_pr_barrier(3), ck_pr_fas(3), ck_pr_load(3), ck_pr_store(3),
64 ck_pr_faa(3), ck_pr_inc(3), ck_pr_dec(3), ck_pr_neg(3), ck_pr_not(3),
65 ck_pr_add(3), ck_pr_sub(3), ck_pr_and(3), ck_pr_or(3), ck_pr_xor(3),
66 ck_pr_cas(3), ck_pr_btc(3), ck_pr_bts(3), ck_pr_btr(3)
67
68 Additional information available at http://concurrencykit.org/
69
70 May 18, 2013