Debian Codegraph @

doc/ck_pr_cas

raw
1 .\"
2 .\" Copyright 2013 Samy Al Bahra.
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\"
27 .Dd April 11, 2013
28 .Dt ck_pr_cas 3
29 .Sh NAME
30 .Nm ck_pr_cas_ptr ,
31 .Nm ck_pr_cas_ptr_value ,
32 .Nm ck_pr_cas_ptr_2 ,
33 .Nm ck_pr_cas_ptr_2_value ,
34 .Nm ck_pr_cas_double ,
35 .Nm ck_pr_cas_double_value ,
36 .Nm ck_pr_cas_char ,
37 .Nm ck_pr_cas_char_value ,
38 .Nm ck_pr_cas_uint ,
39 .Nm ck_pr_cas_uint_value ,
40 .Nm ck_pr_cas_int ,
41 .Nm ck_pr_cas_int_value ,
42 .Nm ck_pr_cas_64_2 ,
43 .Nm ck_pr_cas_64_2_value ,
44 .Nm ck_pr_cas_64 ,
45 .Nm ck_pr_cas_64_value ,
46 .Nm ck_pr_cas_32 ,
47 .Nm ck_pr_cas_32_value ,
48 .Nm ck_pr_cas_16 ,
49 .Nm ck_pr_cas_16_value ,
50 .Nm ck_pr_cas_8 ,
51 .Nm ck_pr_cas_8_value
52 .Nd atomic compare-and-swap operations
53 .Sh LIBRARY
54 Concurrency Kit (libck, \-lck)
55 .Sh SYNOPSIS
56 .In ck_pr.h
57 .Ft bool
58 .Fn ck_pr_cas_ptr "void *target" "void *old_value" "void *new_value"
59 .Ft bool
60 .Fn ck_pr_cas_ptr_value "void *target" "void *old_value" "void *new_value" "void *original_value"
61 .Ft bool
62 .Fn ck_pr_cas_ptr_2 "void *target" "void *old_value" "void *new_value"
63 .Ft bool
64 .Fn ck_pr_cas_ptr_2_value "void *target" "void *old_value" "void *new_value" "void *original_value"
65 .Ft bool
66 .Fn ck_pr_cas_double "double *target" "double old_value" "double new_value"
67 .Ft bool
68 .Fn ck_pr_cas_double_value "double *target" "double old_value" "double new_value" "double *original_value"
69 .Ft bool
70 .Fn ck_pr_cas_char "char *target" "char old_value" "char new_value"
71 .Ft bool
72 .Fn ck_pr_cas_char_value "char *target" "char old_value" "char new_value" "char *original_value"
73 .Ft bool
74 .Fn ck_pr_cas_uint "unsigned int *target" "unsigned int old_value" "unsigned int new_value"
75 .Ft bool
76 .Fn ck_pr_cas_uint_value "unsigned int *target" "unsigned int old_value" "unsigned int new_value" "unsigned int *original_value"
77 .Ft bool
78 .Fn ck_pr_cas_int "int *target" "int old_value" "int new_value"
79 .Ft bool
80 .Fn ck_pr_cas_int_value "int *target" "int old_value" "int new_value" "int *original_value"
81 .Ft bool
82 .Fn ck_pr_cas_64_2 "uint64_t target[static 2]" "uint64_t old_value[static 2]" "uint64_t new_value[static 2]"
83 .Ft bool
84 .Fn ck_pr_cas_64_2_value "uint64_t target[static 2]" "uint64_t old_value[static 2]" "uint64_t new_value[static 2]" "uint64_t original_value[static 2]"
85 .Ft bool
86 .Fn ck_pr_cas_64 "uint64_t *target" "uint64_t old_value" "uint64_t new_value"
87 .Ft bool
88 .Fn ck_pr_cas_64_value "uint64_t *target" "uint64_t old_value" "uint64_t new_value" "uint64_t *original_value"
89 .Ft bool
90 .Fn ck_pr_cas_32 "uint32_t *target" "uint32_t old_value" "uint32_t new_value"
91 .Ft bool
92 .Fn ck_pr_cas_32_value "uint32_t *target" "uint32_t old_value" "uint32_t new_value" "uint32_t *original_value"
93 .Ft bool
94 .Fn ck_pr_cas_16 "uint16_t *target" "uint16_t old_value" "uint16_t new_value"
95 .Ft bool
96 .Fn ck_pr_cas_16_value "uint16_t *target" "uint16_t old_value" "uint16_t new_value" "uint16_t *original_value"
97 .Ft bool
98 .Fn ck_pr_cas_8 "uint8_t *target" "uint8_t old_value" "uint8_t new_value"
99 .Ft bool
100 .Fn ck_pr_cas_8_value "uint8_t *target" "uint8_t old_value" "uint8_t new_value" "uint8_t *original_value"
101 .Sh DESCRIPTION
102 The
103 .Fn ck_pr_cas 3
104 family of functions atomically compare the value in
105 .Fa target
106 for equality with
107 .Fa old_value
108 and if so, replace the value pointed to by
109 .Fa target
110 with the value specified by
111 .Fa new_value .
112 If the value in
113 .Fa target
114 was not equal to the value specified by
115 .Fa old_value
116 then no modifications occur to the value in
117 .Fa target .
118 The *_value form of these functions unconditionally update
119 .Fa original_value .
120 .Sh RETURN VALUES
121 This family of functions return true if the value in
122 .Fa target
123 was modified as a result of the operation. Otherwise, they
124 return false.
125 .Sh SEE ALSO
126 .Xr ck_pr_fence_load 3 ,
127 .Xr ck_pr_fence_load_depends 3 ,
128 .Xr ck_pr_fence_store 3 ,
129 .Xr ck_pr_fence_memory 3 ,
130 .Xr ck_pr_load 3 ,
131 .Xr ck_pr_store 3 ,
132 .Xr ck_pr_fas 3 ,
133 .Xr ck_pr_faa 3 ,
134 .Xr ck_pr_inc 3 ,
135 .Xr ck_pr_dec 3 ,
136 .Xr ck_pr_neg 3 ,
137 .Xr ck_pr_not 3 ,
138 .Xr ck_pr_sub 3 ,
139 .Xr ck_pr_and 3 ,
140 .Xr ck_pr_or 3 ,
141 .Xr ck_pr_xor 3 ,
142 .Xr ck_pr_add 3 ,
143 .Xr ck_pr_btc 3 ,
144 .Xr ck_pr_bts 3 ,
145 .Xr ck_pr_btr 3
146 .Pp
147 Additional information available at http://concurrencykit.org/