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