1ck_pr_fence_memory(3)    BSD Library Functions Manual    ck_pr_fence_memory(3)
2

NAME

4     ck_pr_fence_memory — enforce partial ordering of all memory operations
5

LIBRARY

7     Concurrency Kit (libck, -lck)
8

SYNOPSIS

10     #include <ck_pr.h>
11
12     void
13     ck_pr_fence_memory();
14
15     void
16     ck_pr_fence_strict_memory();
17

DESCRIPTION

19     The ck_pr_fence_memory(3) function enforces the ordering of any memory
20     operations with respect to the invocation of the function. This function
21     always serves as an implicit compiler barrier.  Achitectures implementing
22     CK_MD_TSO do not emit a barrier, but compiler barrier semantics remain.
23     Architectures implementing CK_MD_PSO and CK_MD_RMO always emit an
24     instructions which provides the specified ordering guarantees. To force
25     the unconditional emission of a memory fence, use
26     ck_pr_fence_strict_memory().
27

EXAMPLE

29           #include <ck_pr.h>
30
31           static int a = 0;
32           static int b;
33           static int c;
34           static int d;
35
36           void
37           function(void)
38           {
39                   int snapshot_a;
40
41                   ck_pr_store_int(&b, 1);
42                   snapshot_a = ck_pr_load_int(&a);
43
44                   /*
45                    * Make sure previous memory operations are
46                    * ordered with respect to memory operations
47                    * following the ck_pr_fence_memory.
48                    */
49                   ck_pr_fence_memory();
50
51                   ck_pr_store_int(&d, 3);
52                   ck_pr_store_int(&c, 2);
53
54                   return;
55           }
56

RETURN VALUES

58     This function has no return value.
59

SEE ALSO

61     ck_pr_stall(3), ck_pr_fence_atomic(3), ck_pr_fence_atomic_store(3),
62     ck_pr_fence_atomic_load(3), ck_pr_fence_load(3),
63     ck_pr_fence_load_depends(3), ck_pr_fence_store(3), ck_pr_barrier(3),
64     ck_pr_fas(3), ck_pr_load(3), ck_pr_store(3), ck_pr_faa(3), ck_pr_inc(3),
65     ck_pr_dec(3), ck_pr_neg(3), ck_pr_not(3), ck_pr_add(3), ck_pr_sub(3),
66     ck_pr_and(3), ck_pr_or(3), ck_pr_xor(3), ck_pr_cas(3), ck_pr_btc(3),
67     ck_pr_bts(3), ck_pr_btr(3)
68
69     Additional information available at http://concurrencykit.org/
70
71                                 April 7, 2013
Impressum