summaryrefslogtreecommitdiffstats
path: root/sys/sys/stdatomic.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename __wchar_t so it no longer conflicts with __wchar_t from clang 3.4tijl2014-04-011-1/+1
| | | | | | -fms-extensions. MFC after: 2 weeks
* Change the return type of the fallback implementation of thetijl2013-08-181-2/+2
| | | | atomic_compare_exchange_* macros in stdatomic.h to _Bool.
* Correct implementation of atomic_flag_test_and_setemaste2013-08-171-5/+1
| | | | The function sets the flag and returns the previous value (7.17.8.1).
* Make atomic_fetch_add() and atomic_fetch_sub() work for pointers with GCC 4.2.ed2013-06-301-2/+6
| | | | | | | | | | | According to the standard, atomic_fetch_*() has to behave identical to regular arithmetic. This means that for pointer types, we have to apply the stride when doing addition/subtraction. The GCC documentation seems to imply this is done for __sync_*() as well. Unfortunately, both tests and Googling seems to reveal this is not really the case. Fix this by performing the multiplication with the stride manually.
* Make various fixes to <stdatomic.h>.ed2013-06-301-22/+68
| | | | | | | | | | | - According to the standard, memory_order is a type. Use a typedef. - atomic_*_fence() and atomic_flag_*() are described by the standard as functions. Use inline functions to implement them. - Only expose the atomic_*_explicit() functions in kernel space. We should not use the short-hand functions, as they will always use memory_order_seq_cst.
* Move _Atomic() into <sys/cdefs.h>.ed2013-06-161-4/+0
| | | | | | | That way _Atomic() is defined next to all the other C11 keywords for which we provide compatibility for pre-C11 compilers. While there, fix the definition to place "volatile" at the end. Otherwise pointer types will become "volatile T *" instead of "T * volatile".
* Minor improvements to <stdatomic.h>.ed2013-06-131-2/+8
| | | | | | | | | | | | - Define __SYNC_ATOMICS in case we're using the __sync_*() API. This is not used by <stdatomic.h> itself, but may be useful for some of the intrinsics code to determine whether it should build the machine-dependent intrinsic functions. - Make is_lock_free() work in kernelspace. For now, assume atomics in kernelspace are always lock free. This is a quite reasonable assumption, as we surely shouldn't implement the atomic fallbacks for arbitrary sizes.
* Fix the way atomic_is_lock_free() is defined for Clang.ed2013-06-091-1/+4
| | | | | When using Clang atomics, atomic types are not placed in a structure. There is thus no reason why we should get the __val member.
* Add ATOMIC_*_LOCK_FREE constants.ed2013-06-031-0/+35
| | | | | These constants are part of the C standard. Both Clang and GCC seem to export these constants under the name __GCC_ATOMIC_*_LOCK_FREE.
* Move <stdatomic.h> into sys/sys/.ed2013-06-011-0/+325
This will allow us to use C11 atomics in kernelspace, although it will need to be included as <sys/stdatomic.h>.
OpenPOWER on IntegriCloud