use std::atomic instead of interlocked series APIs.