]>
git.proxmox.com Git - mirror_ovs.git/blob - lib/ovs-atomic-flag-gcc4.7+.h
2 * Copyright (c) 2013, 2014 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 /* This header implements atomic_flag on Clang and on GCC 4.7 and later. */
18 #ifndef IN_OVS_ATOMIC_H
19 #error "This header should only be included indirectly via ovs-atomic.h."
27 #define ATOMIC_FLAG_INIT { .b = false }
30 atomic_flag_test_and_set_explicit(volatile atomic_flag
*object
,
33 return __atomic_test_and_set(&object
->b
, order
);
37 atomic_flag_test_and_set(volatile atomic_flag
*object
)
39 return atomic_flag_test_and_set_explicit(object
, memory_order_seq_cst
);
43 atomic_flag_clear_explicit(volatile atomic_flag
*object
, memory_order order
)
45 __atomic_clear(object
, order
);
49 atomic_flag_clear(volatile atomic_flag
*object
)
51 atomic_flag_clear_explicit(object
, memory_order_seq_cst
);