atomic_suncc.h 1.6 KB

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