One thread writes to the structure, other threads read. It is required to ensure the transactional nature of the record (i.e., so that when two fields are updated, the reading threads cannot be able to read half the updated data). Ideally, for reading, have the const Foo& get() const; method const Foo& get() const; .
The current implementation uses the mutex approach and storing separate copies for each stream in std :: map.
void ConfigUpdater::set(const Config& config) { MutexGuard mutexGuard(mutex); this->config = config; } const Config& ConfigUpdater::get() const { MutexGuard mutexGuard(mutex); return copies.emplace(boost::this_thread::get_id(), config).first->second; } Perhaps there is a better solution, tell me which stronghold to dig.