blob: 027008c7a5200615eabf1895f143c5a2b19919f2 [file] [log] [blame]
Jakub Jelinek6441eb62025-01-02 11:59:57 +01001/* Copyright (C) 2015-2025 Free Software Foundation, Inc.
Joseph Myersc29c36a2015-11-18 22:13:44 +00002
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
Victor Do Nascimento6edf6fe2024-01-31 20:24:45 +000024#define LAT_FLAG
Joseph Myersc29c36a2015-11-18 22:13:44 +000025#include "libatomic_i.h"
26
27#include <stdatomic.h>
28
29/* Out-of-line versions of <stdatomic.h> flag functions. */
30
31/* Atomically set *OBJECT to true, returning the previous value. */
32
33_Bool
34(atomic_flag_test_and_set) (volatile atomic_flag *object)
35{
36 return atomic_flag_test_and_set (object);
37}
38
39/* Atomically set *OBJECT to true, returning the previous value, with
40 memory affected according to ORDER. */
41
42_Bool
43(atomic_flag_test_and_set_explicit) (volatile atomic_flag *object,
44 memory_order order)
45{
46 return atomic_flag_test_and_set_explicit (object, order);
47}
48
49/* Atomically set *OBJECT to false. */
50
51void
52(atomic_flag_clear) (volatile atomic_flag *object)
53{
54 atomic_flag_clear (object);
55}
56
57/* Atomically set *OBJECT to false, with memory affected according to
58 ORDER. */
59
60void
61(atomic_flag_clear_explicit) (volatile atomic_flag *object,
62 memory_order order)
63{
64 return atomic_flag_clear_explicit (object, order);
65}
Victor Do Nascimento6edf6fe2024-01-31 20:24:45 +000066#undef LAT_FLAG