use std::atomic<bool>::compare_exchange_strong() to ensure messages only appears once