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

NAME

4     ck_pr_cas_ptr, ck_pr_cas_ptr_value, ck_pr_cas_ptr_2,
5     ck_pr_cas_ptr_2_value, ck_pr_cas_double, ck_pr_cas_double_value,
6     ck_pr_cas_char, ck_pr_cas_char_value, ck_pr_cas_uint,
7     ck_pr_cas_uint_value, ck_pr_cas_int, ck_pr_cas_int_value, ck_pr_cas_64_2,
8     ck_pr_cas_64_2_value, ck_pr_cas_64, ck_pr_cas_64_value, ck_pr_cas_32,
9     ck_pr_cas_32_value, ck_pr_cas_16, ck_pr_cas_16_value, ck_pr_cas_8,
10     ck_pr_cas_8_value — atomic compare-and-swap operations
11

LIBRARY

13     Concurrency Kit (libck, -lck)
14

SYNOPSIS

16     #include <ck_pr.h>
17
18     bool
19     ck_pr_cas_ptr(void *target, void *old_value, void *new_value);
20
21     bool
22     ck_pr_cas_ptr_value(void *target, void *old_value, void *new_value,
23         void *original_value);
24
25     bool
26     ck_pr_cas_ptr_2(void *target, void *old_value, void *new_value);
27
28     bool
29     ck_pr_cas_ptr_2_value(void *target, void *old_value, void *new_value,
30         void *original_value);
31
32     bool
33     ck_pr_cas_double(double *target, double old_value, double new_value);
34
35     bool
36     ck_pr_cas_double_value(double *target, double old_value,
37         double new_value, double *original_value);
38
39     bool
40     ck_pr_cas_char(char *target, char old_value, char new_value);
41
42     bool
43     ck_pr_cas_char_value(char *target, char old_value, char new_value,
44         char *original_value);
45
46     bool
47     ck_pr_cas_uint(unsigned int *target, unsigned int old_value,
48         unsigned int new_value);
49
50     bool
51     ck_pr_cas_uint_value(unsigned int *target, unsigned int old_value,
52         unsigned int new_value, unsigned int *original_value);
53
54     bool
55     ck_pr_cas_int(int *target, int old_value, int new_value);
56
57     bool
58     ck_pr_cas_int_value(int *target, int old_value, int new_value,
59         int *original_value);
60
61     bool
62     ck_pr_cas_64_2(uint64_t target[static 2], uint64_t old_value[static 2],
63         uint64_t new_value[static 2]);
64
65     bool
66     ck_pr_cas_64_2_value(uint64_t target[static 2],
67         uint64_t old_value[static 2], uint64_t new_value[static 2],
68         uint64_t original_value[static 2]);
69
70     bool
71     ck_pr_cas_64(uint64_t *target, uint64_t old_value, uint64_t new_value);
72
73     bool
74     ck_pr_cas_64_value(uint64_t *target, uint64_t old_value,
75         uint64_t new_value, uint64_t *original_value);
76
77     bool
78     ck_pr_cas_32(uint32_t *target, uint32_t old_value, uint32_t new_value);
79
80     bool
81     ck_pr_cas_32_value(uint32_t *target, uint32_t old_value,
82         uint32_t new_value, uint32_t *original_value);
83
84     bool
85     ck_pr_cas_16(uint16_t *target, uint16_t old_value, uint16_t new_value);
86
87     bool
88     ck_pr_cas_16_value(uint16_t *target, uint16_t old_value,
89         uint16_t new_value, uint16_t *original_value);
90
91     bool
92     ck_pr_cas_8(uint8_t *target, uint8_t old_value, uint8_t new_value);
93
94     bool
95     ck_pr_cas_8_value(uint8_t *target, uint8_t old_value, uint8_t new_value,
96         uint8_t *original_value);
97

DESCRIPTION

99     The ck_pr_cas(3) family of functions atomically compare the value in
100     target for equality with old_value and if so, replace the value pointed
101     to by target with the value specified by new_value.  If the value in
102     target was not equal to the value specified by old_value then no modifi‐
103     cations occur to the value in target.  The *_value form of these func‐
104     tions unconditionally update original_value.
105

RETURN VALUES

107     This family of functions return true if the value in target was modified
108     as a result of the operation. Otherwise, they return false.
109

SEE ALSO

111     ck_pr_fence_load(3), ck_pr_fence_load_depends(3), ck_pr_fence_store(3),
112     ck_pr_fence_memory(3), ck_pr_load(3), ck_pr_store(3), ck_pr_fas(3),
113     ck_pr_faa(3), ck_pr_inc(3), ck_pr_dec(3), ck_pr_neg(3), ck_pr_not(3),
114     ck_pr_sub(3), ck_pr_and(3), ck_pr_or(3), ck_pr_xor(3), ck_pr_add(3),
115     ck_pr_btc(3), ck_pr_bts(3), ck_pr_btr(3)
116
117     Additional information available at http://concurrencykit.org/
118
119                                April 11, 2013
Impressum