123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef __SYSDEP_LOCKS_H__
- #define __SYSDEP_LOCKS_H__
- typedef unsigned obj_addr_t __attribute__((__mode__(__pointer__)));
- inline static bool
- compare_and_swap(volatile obj_addr_t *addr,
- obj_addr_t old,
- obj_addr_t new_val)
- {
- return __sync_bool_compare_and_swap(addr, old, new_val);
- }
- inline static void
- release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
- {
- __sync_synchronize();
- *(addr) = new_val;
- }
- inline static bool
- compare_and_swap_release(volatile obj_addr_t *addr,
- obj_addr_t old,
- obj_addr_t new_val)
- {
- return __sync_bool_compare_and_swap(addr, old, new_val);
- }
- inline static void
- read_barrier()
- {
- __sync_synchronize();
- }
- inline static void
- write_barrier()
- {
- __sync_synchronize();
- }
- #endif
|