type __sync_fetch_and_add(type *ptr, type value,...);// 先fetch然后自加,返回的是自加以前的值
type __sync_fetch_and_sub(type *ptr, type value,...);
type __sync_fetch_and_or(type *ptr, type value,...);
type __sync_fetch_and_and(type *ptr, type value,...);
type __sync_fetch_and_xor(type *ptr, type value,...);
type __sync_fetch_and_nand(type *ptr, type value,...);
type __sync_add_and_fetch(type *ptr, type value,...);// 先自加然后返回,返回的是自加以后的值
type __sync_sub_and_fetch(type *ptr, type value,...);
type __sync_or_and_fetch(type *ptr, type value,...);
type __sync_and_and_fetch(type *ptr, type value,...);
type __sync_xor_and_fetch(type *ptr, type value,...);
type __sync_nand_and_fetch(type *ptr, type value,...);
//以下两个函数提供原子的比较和交换, 如果*ptr = oldValue, 就将newValue写入*ptr//第一个函数在相等并写入的情况下返回true//第二个函数返回操作之前的值
bool __sync_bool_compare_and_swap(type* ptr, type oldValue, type newValue,....);
type __sync_val_compare_and_swap(type* ptr, type oldValue, type newValue,....);//将*ptr设为value并返回*ptr操作之前的值
type __sync_lock_test_and_set(type *ptr, type value,....);//置*ptr为0void__sync_lock_release(type* ptr,....);