1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc.
.\" All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ATOMIC_DEC 9F "Jan 16, 2006"
.SH NAME
atomic_dec, atomic_dec_8, atomic_dec_uchar, atomic_dec_16, atomic_dec_ushort,
atomic_dec_32, atomic_dec_uint, atomic_dec_ulong, atomic_dec_64,
atomic_dec_ptr, atomic_dec_8_nv, atomic_dec_uchar_nv, atomic_dec_16_nv,
atomic_dec_ushort_nv, atomic_dec_32_nv, atomic_dec_uint_nv,
atomic_dec_ulong_nv, atomic_dec_64_nv, atomic_dec_ptr_nv \- atomic decrement
operations
.SH SYNOPSIS
.LP
.nf
#include <sys/atomic.h>
\fBvoid\fR \fBatomic_dec_8\fR(\fBvolatile uint8_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_uchar\fR(\fBvolatile uchar_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_16\fR(\fBvolatile uint16_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_ushort\fR(\fBvolatile ushort_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_32\fR(\fBvolatile uint32_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_uint\fR(\fBvolatile uint_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_ulong\fR(\fBvolatile ulong_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_64\fR(\fBvolatile uint64_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid\fR \fBatomic_dec_ptr\fR(\fBvolatile void *\fR\fItarget\fR);
.fi
.LP
.nf
\fBuint8_t\fR \fBatomic_dec_8_nv\fR(\fBvolatile uint8_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBuchar_t\fR \fBatomic_dec_uchar_nv\fR(\fBvolatile uchar_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBuint16_t\fR \fBatomic_dec_16_nv\fR(\fBvolatile uint16_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBushort_t\fR \fBatomic_dec_ushort_nv\fR(\fBvolatile ushort_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBuint32_t\fR \fBatomic_dec_32_nv\fR(\fBvolatile uint32_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBuint_t\fR \fBatomic_dec_uint_nv\fR(\fBvolatile uint_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBulong_t\fR \fBatomic_dec_ulong_nv\fR(\fBvolatile ulong_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBuint64_t\fR \fBatomic_dec_64_nv\fR(\fBvolatile uint64_t *\fR\fItarget\fR);
.fi
.LP
.nf
\fBvoid *\fR\fBatomic_dec_ptr_nv\fR(\fBvolatile void *\fR\fItarget\fR);
.fi
.SH DESCRIPTION
.sp
.LP
These functions enable the decrementing (by one) of the value stored in
\fItarget\fR to occur in an atomic manner.
.SH RETURN VALUES
.sp
.LP
The *\fB_nv()\fR variants of these functions return the new value of
\fItarget\fR.
.SH ERRORS
.sp
.LP
No errors are defined.
.SH CONTEXT
.sp
.LP
These functions can be called from user, interrupt, or kernel context.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Committed
.TE
.SH SEE ALSO
.sp
.LP
\fBatomic_add\fR(9F), \fBatomic_and\fR(9F), \fBatomic_bits\fR(9F),
\fBatomic_cas\fR(9F), \fBatomic_inc\fR(9F), \fBatomic_or\fR(9F),
\fBatomic_swap\fR(9F), \fBmembar_ops\fR(9F), \fBattributes\fR(5),
\fBatomic_ops\fR(3C)
.SH NOTES
.sp
.LP
The *\fB_nv()\fR variants are substantially more expensive on some platforms
than the versions that do not return values. Do not use them unless you need to
know the new value atomically (for example, when decrementing a reference count
and checking whether it went to zero).
|