Differences From Artifact [394f138c54]:
- File
src/threading.h
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 6283) [annotate] [blame] [check-ins using]
To Artifact [774a47eec4]:
- File src/threading.h — part of check-in [48ffea9a9a] at 2017-04-13 13:19:02 on branch trunk — Clean up memory barriers (user: js, size: 6288) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
180 181 182 183 184 185 186 | } static OF_INLINE bool of_spinlock_trylock(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) if (of_atomic_int_cmpswap(spinlock, 0, 1)) { | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | } static OF_INLINE bool of_spinlock_trylock(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) if (of_atomic_int_cmpswap(spinlock, 0, 1)) { of_memory_barrier_acquire(); return true; } return false; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_trylock(spinlock); #else |
︙ | ︙ | |||
219 220 221 222 223 224 225 | static OF_INLINE bool of_spinlock_unlock(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) bool ret = of_atomic_int_cmpswap(spinlock, 1, 0); | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | static OF_INLINE bool of_spinlock_unlock(of_spinlock_t *spinlock) { #if defined(OF_HAVE_ATOMIC_OPS) bool ret = of_atomic_int_cmpswap(spinlock, 1, 0); of_memory_barrier_release(); return ret; #elif defined(OF_HAVE_PTHREAD_SPINLOCKS) return !pthread_spin_unlock(spinlock); #else return of_mutex_unlock(spinlock); #endif |
︙ | ︙ |