'\" 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_CAS 9F "Jan 16, 2006" .SH NAME atomic_cas, atomic_cas_8, atomic_cas_uchar, atomic_cas_16, atomic_cas_ushort, atomic_cas_32, atomic_cas_uint, atomic_cas_ulong, atomic_cas_64, atomic_cas_ptr \- atomic compare and swap operations .SH SYNOPSIS .LP .nf #include \fBuint8_t\fR \fBatomic_cas_8\fR(\fBvolatile uint8_t *\fR\fItarget\fR, \fBuint8_t\fR \fIcmp\fR, \fBuint8_t\fR \fInewval\fR); .fi .LP .nf \fBuchar_t\fR \fBatomic_cas_uchar\fR(\fBvolatile uchar_t *\fR\fItarget\fR, \fBuchar_t\fR \fIcmp\fR, \fBuchar_t\fR \fInewval\fR); .fi .LP .nf \fBuint16_t\fR \fBatomic_cas_16\fR(\fBvolatile uint16_t *\fR\fItarget\fR, \fBuint16_t\fR \fIcmp\fR, \fBuint16_t\fR \fInewval\fR); .fi .LP .nf \fBushort_t\fR \fBatomic_cas_ushort\fR(\fBvolatile ushort_t *\fR\fItarget\fR, \fBushort_t\fR \fIcmp\fR, \fBushort_t\fR \fInewval\fR); .fi .LP .nf \fBuint32_t\fR \fBatomic_cas_32\fR(\fBvolatile uint32_t *\fR\fItarget\fR, \fBuint32_t\fR \fIcmp\fR, \fBuint32_t\fR \fInewval\fR); .fi .LP .nf \fBuint_t\fR \fBatomic_cas_uint\fR(\fBvolatile uint_t *\fR\fItarget\fR, \fBuint_t\fR \fIcmp\fR, \fBuint_t\fR \fInewval\fR); .fi .LP .nf \fBulong_t\fR \fBatomic_cas_ulong\fR(\fBvolatile ulong_t *\fR\fItarget\fR, \fBulong_t\fR \fIcmp\fR, \fBulong_t\fR \fInewval\fR); .fi .LP .nf \fBuint64_t\fR \fBatomic_cas_64\fR(\fBvolatile uint64_t *\fR\fItarget\fR, \fBuint64_t\fR \fIcmp\fR, \fBuint64_t\fR \fInewval\fR); .fi .LP .nf \fBvoid *\fR\fBatomic_cas_ptr\fR(\fBvolatile void *\fR\fItarget\fR, \fBvoid *\fR\fIcmp\fR, \fBvoid *\fR\fInewval\fR); .fi .SH DESCRIPTION .sp .LP These functions enable a compare and swap operation to occur atomically. The value stored in \fItarget\fR is compared with \fIcmp\fR. If these values are equal, the value stored in \fItarget\fR is replaced with \fInewval\fR. The old value stored in \fItarget\fR is returned by the function whether or not the replacement occurred. .SH RETURN VALUES .sp .LP These functions return the old 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_dec\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)