xref: /openbsd/share/man/man9/atomic_setbits_int.9 (revision 09467b48)
1.\" $OpenBSD: atomic_setbits_int.9,v 1.3 2014/02/13 14:25:21 jmc Exp $
2.\"
3.\" Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
4.\" All rights reserved.
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: February 13 2014 $
19.Dt ATOMIC_SETBITS_INT 9
20.Os
21.Sh NAME
22.Nm atomic_setbits_int ,
23.Nm atomic_clearbits_int
24.Nd interface to perform atomic operations on data
25.Sh SYNOPSIS
26.In sys/atomic.h
27.Ft void
28.Fn atomic_setbits_int "unsigned int *p" "unsigned int b"
29.Ft void
30.Fn atomic_clearbits_int "unsigned int *p" "unsigned int b"
31.Sh DESCRIPTION
32The atomic bits set of functions provide an interface for changing data atomically with respect to interrupts and multiple processors in the system.
33.Pp
34The
35.Fn atomic_setbits_int
36function sets the bits in
37.Fa b
38in the integer pointed to by
39.Fa p .
40It is equivalent to
41.Bd -literal -offset indent
42*p |= b;
43.Ed
44.Pp
45The
46.Fn atomic_clearbits_int
47function clears the bits in
48.Fa b
49in the integer pointed to by
50.Fa p .
51It is equivalent to
52.Bd -literal -offset indent
53*p &= ~b;
54.Ed
55.Sh CONTEXT
56.Fn atomic_setbits_int ,
57and
58.Fn atomic_clearbits_int
59can be called during autoconf, from process context, or from interrupt context.
60.Sh SEE ALSO
61.Xr atomic_add_int 9 ,
62.Xr atomic_cas_uint 9 ,
63.Xr atomic_dec_int 9 ,
64.Xr atomic_inc_int 9 ,
65.Xr atomic_sub_int 9 ,
66.Xr atomic_swap_uint 9
67.Sh HISTORY
68The
69.Nm
70functions first appeared in
71.Ox 4.1 .
72