1CK_PR_FENCE_LOAD_ATOM... BSD Library Functions Manual CK_PR_FENCE_LOAD_ATOM...
2
4 ck_pr_fence_load_atomic — enforce ordering of load operations to atomic
5 read-modify-write operations
6
8 Concurrency Kit (libck, -lck)
9
11 #include <ck_pr.h>
12
13 void
14 ck_pr_fence_load_atomic(void);
15
16 void
17 ck_pr_fence_strict_load_atomic(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_atomic() is also be made visible only after a call to
25 the ck_pr_fence_load family of functions. This function always serves as
26 an implicit compiler barrier. On architectures with CK_MD_TSO or
27 CK_MD_PSO specified (total store ordering and partial store ordering
28 respectively), this operation only serves as a compiler barrier and no
29 fence instructions will be emitted. To force the unconditional emission
30 of a load fence, use ck_pr_fence_strict_load_atomic(). Architectures
31 implementing 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, snapshot_b;
43
44 snapshot_a = ck_pr_load_uint(&a);
45
46 /*
47 * Guarantee that the load from "a" completes
48 * before the update to "b".
49 */
50 ck_pr_fence_load_atomic();
51 ck_pr_fas_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_store(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