libatomic: perform write before context switch