I have the following senario,
class enum class Status {
Unknown, Pause, Normal, Resume
}
std::unordered_map<int, Status> status_map;
If at beginning I know all the key in status_map and initialze,
for(auto key:key_list) {
status_map[key]=Status::Unknown;
}
Then later, thread1
will change known key's status, and thread2
will keep reading the status_map
to make some decision, will this whole operation thread-safe?