'\" te .\" Copyright (c) 2005, 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_swap 3C "13 May 2005" "SunOS 5.11" "Standard C Library Functions" .SH NAME atomic_swap, atomic_swap_8, atomic_swap_uchar, atomic_swap_16, atomic_swap_ushort, atomic_swap_32, atomic_swap_uint, atomic_swap_ulong, atomic_swap_64, atomic_swap_ptr \- atomic swap operations .SH SYNOPSIS .LP .nf #include \fBuint8_t\fR \fBatomic_swap_8\fR(\fBvolatile uint8_t *\fR\fItarget\fR, \fBuint8_t\fR \fInewval\fR); .fi .LP .nf \fBuchar_t\fR \fBatomic_swap_uchar\fR(\fBvolatile uchar_t *\fR\fItarget\fR, \fBuchar_t\fR \fInewval\fR); .fi .LP .nf \fBuint16_t\fR \fBatomic_swap_16\fR(\fBvolatile uint16_t *\fR\fItarget\fR, \fBuint16_t\fR \fInewval\fR); .fi .LP .nf \fBushort_t\fR \fBatomic_swap_ushort\fR(\fBvolatile ushort_t *\fR\fItarget\fR, \fBushort_t\fR \fInewval\fR); .fi .LP .nf \fBuint32_t\fR \fBatomic_swap_32\fR(\fBvolatile uint32_t *\fR\fItarget\fR, \fBuint32_t\fR \fInewval\fR); .fi .LP .nf \fBuint_t\fR \fBatomic_swap_uint\fR(\fBvolatile uint_t *\fR\fItarget\fR, \fBuint_t\fR \fInewval\fR); .fi .LP .nf \fBulong_t\fR \fBatomic_swap_ulong\fR(\fBvolatile ulong_t *\fR\fItarget\fR, \fBulong_t\fR \fInewval\fR); .fi .LP .nf \fBuint64_t\fR \fBatomic_swap_64\fR(\fBvolatile uint64_t *\fR\fItarget\fR, \fBuint64_t\fR \fInewval\fR); .fi .LP .nf \fBvoid *\fR\fBatomic_swap_ptr\fR(\fBvolatile void *\fR\fItarget\fR, \fBvoid *\fR\fInewval\fR); .fi .SH DESCRIPTION .sp .LP These functions enable a swap operation to occur atomically. The value stored in \fItarget\fR is replaced with \fInewval\fR. The old value is returned by the function. .SH RETURN VALUES .sp .LP These functions return the old of *\fItarget\fR. .SH ERRORS .sp .LP No errors are defined. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityStable _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBatomic_add\fR(3C), \fBatomic_and\fR(3C), \fBatomic_bits\fR(3C), \fBatomic_dec\fR(3C), \fBatomic_inc\fR(3C), \fBatomic_or\fR(3C), \fBatomic_cas\fR(3C), \fBmembar_ops\fR(3C), \fBattributes\fR(5), \fBatomic_ops\fR(9F)