xchg is atomic with side-effects