Use atomics instead of volatile