
原子操作:#include <stdint.h>
用到的函数:
__sync_val_compare_and_swap(&value_, 0, 0);// __sync_val_compare_and_swap(type *ptr,type oldval, type newval)// if *ptr==oldval oldval =newval return oldval; else return oldval;__sync_fetch_and_add(&value_, x);__sync_lock_test_and_set(&value_, newValue);typedef detail::AtomicIntegerT<int32_t> AtomicInt32;typedef detail::AtomicIntegerT<int64_t> AtomicInt64;
