| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
-fms-extensions.
MFC after: 2 weeks
|
|
|
|
| |
atomic_compare_exchange_* macros in stdatomic.h to _Bool.
|
|
|
|
| |
The function sets the flag and returns the previous value (7.17.8.1).
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
|
| |
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".
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
| |
When using Clang atomics, atomic types are not placed in a structure.
There is thus no reason why we should get the __val member.
|
|
|
|
|
| |
These constants are part of the C standard. Both Clang and GCC seem to
export these constants under the name __GCC_ATOMIC_*_LOCK_FREE.
|
|
This will allow us to use C11 atomics in kernelspace, although it will
need to be included as <sys/stdatomic.h>.
|