]> git.ipfire.org Git - thirdparty/gcc.git/blame - libatomic/flag.c
[Ada] Use Standard.Natural on bit references to packed arrays
[thirdparty/gcc.git] / libatomic / flag.c
CommitLineData
8d9254fc 1/* Copyright (C) 2015-2020 Free Software Foundation, Inc.
c29c36ad
JM
2
3 This file is part of the GNU Atomic Library (libatomic).
4
5 Libatomic is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
18
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
23
24#include "libatomic_i.h"
25
26#include <stdatomic.h>
27
28/* Out-of-line versions of <stdatomic.h> flag functions. */
29
30/* Atomically set *OBJECT to true, returning the previous value. */
31
32_Bool
33(atomic_flag_test_and_set) (volatile atomic_flag *object)
34{
35 return atomic_flag_test_and_set (object);
36}
37
38/* Atomically set *OBJECT to true, returning the previous value, with
39 memory affected according to ORDER. */
40
41_Bool
42(atomic_flag_test_and_set_explicit) (volatile atomic_flag *object,
43 memory_order order)
44{
45 return atomic_flag_test_and_set_explicit (object, order);
46}
47
48/* Atomically set *OBJECT to false. */
49
50void
51(atomic_flag_clear) (volatile atomic_flag *object)
52{
53 atomic_flag_clear (object);
54}
55
56/* Atomically set *OBJECT to false, with memory affected according to
57 ORDER. */
58
59void
60(atomic_flag_clear_explicit) (volatile atomic_flag *object,
61 memory_order order)
62{
63 return atomic_flag_clear_explicit (object, order);
64}