ObjFW
atomic.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #include <stdlib.h>
17 
18 #import "macros.h"
19 
20 #ifndef OF_HAVE_ATOMIC_OPS
21 # error No atomic operations available!
22 #endif
23 
24 #if !defined(OF_HAVE_THREADS)
25 # import "atomic_no_threads.h"
26 #elif (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__)
27 # import "atomic_x86.h"
28 #elif defined(OF_POWERPC) && defined(__GNUC__) && !defined(__APPLE_CC__) && \
29  !defined(OF_AIX)
30 # import "atomic_powerpc.h"
31 #elif defined(OF_HAVE_ATOMIC_BUILTINS)
32 # import "atomic_builtins.h"
33 #elif defined(OF_HAVE_SYNC_BUILTINS)
34 # import "atomic_sync_builtins.h"
35 #elif defined(OF_HAVE_OSATOMIC)
36 # import "atomic_osatomic.h"
37 #else
38 # error No atomic operations available!
39 #endif