[haiku-gsoc] Re: Implementation Queries

  • From: Julian Harnath <julian.harnath@xxxxxxxxxxxxxx>
  • To: <haiku-gsoc@xxxxxxxxxxxxx>
  • Date: Fri, 16 Jun 2017 22:36:04 +0200

Hey,

On 16.06.2017 20:43, Vivek Roy wrote:

Started a new thread as the questions are no longer related to Licensing.

asm/atomic.h requires declarations of functions atomic_cmpset_int and atomic_load_acq_int. Any help with those?

For the expected behaviour of these, see [0].Assuming gcc5 usage, you can use gcc builtins [1]to implement them.

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.

Feel free to ask if you need further help with this.

[0] https://www.freebsd.org/cgi/man.cgi?query=atomic&sektion=9
[1] https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

Regards
Julian

Other related posts: