Differences From Artifact [17afd94567]:
- File
src/atomic.h
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 20353) [annotate] [blame] [check-ins using]
To Artifact [c6a5af4a20]:
- File
src/atomic.h
— part of check-in
[96a128f954]
at
2016-07-30 21:18:37
on branch trunk
— atomic.h: Improve memory barrier
Replace of_memory_read_barrier() and of_memory_write_barrier() - which
are quite unspecific - with of_memory_enter_barrier() and
of_memory_leave_barrier().Also add an assembly implementation for ARM and ARM64. (user: js, size: 20222) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
967 968 969 970 971 972 973 974 975 | #endif } static OF_INLINE void of_memory_barrier(void) { #if !defined(OF_HAVE_THREADS) #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( | > | | > > > > | < < < < < < < | < < < < < < < | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | #endif } static OF_INLINE void of_memory_barrier(void) { #if !defined(OF_HAVE_THREADS) /* nop */ #elif defined(OF_X86_64_ASM) || defined(OF_X86_ASM) __asm__ __volatile__ ( "mfence" ::: "memory" ); #elif defined(OF_POWERPC_ASM) __asm__ __volatile__ ( "sync" ::: "memory" ); #elif defined(OF_ARMV7_ASM) || defined(OF_ARM64_ASM) __asm__ __volatile__ ( "dmb" ::: "memory" ); #elif defined(OF_HAVE_GCC_ATOMIC_OPS) __sync_synchronize(); #elif defined(OF_HAVE_OSATOMIC) OSMemoryBarrier(); #else # error of_memory_barrier not implemented! #endif } static OF_INLINE void of_memory_enter_barrier(void) { of_memory_barrier(); } static OF_INLINE void of_memory_leave_barrier(void) { of_memory_barrier(); } OF_ASSUME_NONNULL_END |