Wrap end-of-stream flags with atomic accesses.