replace spins on memory with barriers
todo update