[haiku-gsoc] Re: Implementation Queries

  • From: Vivek Roy <vivekroyandroid@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Sun, 18 Jun 2017 13:35:06 +0530


atomic_cmpset_int() can be implemented using gcc's
__atomic_compare_exchange() with memorder set to __ATOMIC_RELAXED.
atomic_load_acq_int() can use gcc's __atomic_load() with memorder set to
__ATOMIC_ACQUIRE.

atomic_cmpset_int and atomic_load_acq_int were called from inside 
atomic_cmpxchg.
So instead of having a macro for them I made a macro for atomic_cmpxchg
using __atomic_compare_exchange_n as you can see here
<https://github.com/vivek-roy/haiku/blob/9026ac8d45499d16e78b16058ba580467e9fbe3d/headers/compatibility/linuxkpi/asm/atomic.h#L60>
(and things work fine).

Next comes mutex. I hope the mutex implemented in
src/libs/compat/freebsd_network/compat/sys/mutex.h will be good enough.

Other related posts: