1*d9781408Sbluhm.\" $OpenBSD: atomic_load_int.9,v 1.1 2022/03/10 14:12:40 bluhm Exp $ 2*d9781408Sbluhm.\" 3*d9781408Sbluhm.\" Copyright (c) 2014 David Gwynne <dlg@openbsd.org> 4*d9781408Sbluhm.\" Copyright (c) 2022 Alexander Bluhm <bluhm@openbsd.org> 5*d9781408Sbluhm.\" All rights reserved. 6*d9781408Sbluhm.\" 7*d9781408Sbluhm.\" Permission to use, copy, modify, and distribute this software for any 8*d9781408Sbluhm.\" purpose with or without fee is hereby granted, provided that the above 9*d9781408Sbluhm.\" copyright notice and this permission notice appear in all copies. 10*d9781408Sbluhm.\" 11*d9781408Sbluhm.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12*d9781408Sbluhm.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13*d9781408Sbluhm.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14*d9781408Sbluhm.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15*d9781408Sbluhm.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16*d9781408Sbluhm.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17*d9781408Sbluhm.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18*d9781408Sbluhm.\" 19*d9781408Sbluhm.Dd $Mdocdate: March 10 2022 $ 20*d9781408Sbluhm.Dt ATOMIC_LOAD_INT 9 21*d9781408Sbluhm.Os 22*d9781408Sbluhm.Sh NAME 23*d9781408Sbluhm.Nm atomic_load_int , 24*d9781408Sbluhm.Nm atomic_load_long , 25*d9781408Sbluhm.Nm atomic_store_long , 26*d9781408Sbluhm.Nm atomic_store_int 27*d9781408Sbluhm.Nd atomic read and write memory operations 28*d9781408Sbluhm.Sh SYNOPSIS 29*d9781408Sbluhm.In sys/atomic.h 30*d9781408Sbluhm.Ft unsigned int 31*d9781408Sbluhm.Fn atomic_load_int "volatile unsigned int *p" 32*d9781408Sbluhm.Ft unsigned long 33*d9781408Sbluhm.Fn atomic_load_long "volatile unsigned long *p" 34*d9781408Sbluhm.Ft void 35*d9781408Sbluhm.Fn atomic_store_int "volatile unsigned int *p" "unsigned int v" 36*d9781408Sbluhm.Ft void 37*d9781408Sbluhm.Fn atomic_store_long "volatile unsigned long *p" "unsigned long v" 38*d9781408Sbluhm.Sh DESCRIPTION 39*d9781408SbluhmThe atomic_load and atomic_store set of functions provide an interface 40*d9781408Sbluhmfor atomically performing read or write memory operations with 41*d9781408Sbluhmrespect to interrupts and multiple processors in the system. 42*d9781408Sbluhm.Pp 43*d9781408SbluhmThe atomic_store functions change the value referenced by the pointer 44*d9781408Sbluhm.Fa p 45*d9781408Sbluhmto the value 46*d9781408Sbluhm.Fa v . 47*d9781408Sbluhm.Sh CONTEXT 48*d9781408Sbluhm.Fn atomic_load_int , 49*d9781408Sbluhm.Fn atomic_load_long , 50*d9781408Sbluhm.Fn atomic_store_int , 51*d9781408Sbluhmand 52*d9781408Sbluhm.Fn atomic_store_long 53*d9781408Sbluhmcan all be called during autoconf, from process context, or from 54*d9781408Sbluhminterrupt context. 55*d9781408Sbluhm.Sh RETURN VALUES 56*d9781408Sbluhm.Nm atomic_load_int 57*d9781408Sbluhmand 58*d9781408Sbluhm.Nm atomic_load_long 59*d9781408Sbluhmreturn the value at 60*d9781408Sbluhm.Fa p . 61*d9781408Sbluhm.Sh SEE ALSO 62*d9781408Sbluhm.Xr atomic_add_int 9 , 63*d9781408Sbluhm.Xr atomic_add_long 9 , 64*d9781408Sbluhm.Xr atomic_sub_int 9 , 65*d9781408Sbluhm.Xr atomic_sub_long 9 66*d9781408Sbluhm.Sh HISTORY 67*d9781408SbluhmThe atomic_load and atomic_store functions first appeared in 68*d9781408Sbluhm.Ox 7.1 . 69