You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5KB

  1. /*
  2. *
  3. * This file is part of Libav.
  4. *
  5. * Libav is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * Libav is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with Libav; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <atomic.h>
  20. #include <mbarrier.h>
  21. #include "atomic.h"
  22. #define avpriv_atomic_int_get atomic_int_get_suncc
  23. static inline int atomic_int_get_suncc(volatile int *ptr)
  24. {
  25. __machine_rw_barrier();
  26. return *ptr;
  27. }
  28. #define avpriv_atomic_int_set atomic_int_set_suncc
  29. static inline void atomic_int_set_suncc(volatile int *ptr, int val)
  30. {
  31. *ptr = val;
  32. __machine_rw_barrier();
  33. }
  34. #define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_suncc
  35. static inline int atomic_int_add_and_fetch_suncc(volatile int *ptr, int inc)
  36. {
  37. return atomic_add_int_nv(ptr, inc);
  38. }
  39. #define avpriv_atomic_ptr_cas atomic_ptr_cas_suncc
  40. static inline void *atomic_ptr_cas_suncc(void * volatile *ptr,
  41. void *oldval, void *newval)
  42. {
  43. return atomic_cas_ptr(ptr, oldval, newval);
  44. }