atomic_suncc.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. *
  3. * This file is part of FFmpeg.
  4. *
  5. * FFmpeg 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. * FFmpeg 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 FFmpeg; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #ifndef AVUTIL_ATOMIC_SUNCC_H
  20. #define AVUTIL_ATOMIC_SUNCC_H
  21. #include <atomic.h>
  22. #include <mbarrier.h>
  23. #include "atomic.h"
  24. #define avpriv_atomic_int_get atomic_int_get_suncc
  25. static inline int atomic_int_get_suncc(volatile int *ptr)
  26. {
  27. __machine_rw_barrier();
  28. return *ptr;
  29. }
  30. #define avpriv_atomic_int_set atomic_int_set_suncc
  31. static inline void atomic_int_set_suncc(volatile int *ptr, int val)
  32. {
  33. *ptr = val;
  34. __machine_rw_barrier();
  35. }
  36. #define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_suncc
  37. static inline int atomic_int_add_and_fetch_suncc(volatile int *ptr, int inc)
  38. {
  39. return atomic_add_int_nv(ptr, inc);
  40. }
  41. #define avpriv_atomic_ptr_cas atomic_ptr_cas_suncc
  42. static inline void *atomic_ptr_cas_suncc(void * volatile *ptr,
  43. void *oldval, void *newval)
  44. {
  45. return atomic_cas_ptr(ptr, oldval, newval);
  46. }
  47. #endif /* AVUTIL_ATOMIC_SUNCC_H */