Jakub Jelinek | 6441eb6 | 2025-01-02 11:59:57 +0100 | [diff] [blame] | 1 | /* Copyright (C) 2015-2025 Free Software Foundation, Inc. |
Joseph Myers | c29c36a | 2015-11-18 22:13:44 +0000 | [diff] [blame] | 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 | |
Victor Do Nascimento | 6edf6fe | 2024-01-31 20:24:45 +0000 | [diff] [blame] | 24 | #define LAT_FLAG |
Joseph Myers | c29c36a | 2015-11-18 22:13:44 +0000 | [diff] [blame] | 25 | #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 | |
| 51 | void |
| 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 | |
| 60 | void |
| 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 Nascimento | 6edf6fe | 2024-01-31 20:24:45 +0000 | [diff] [blame] | 66 | #undef LAT_FLAG |