replace ATOMIC_CAS by ATOMIC_WRITE
replace some functions with macros + optimize client's wakeup logic
tserver