By building the map in a local variable and then swapping it with the member variable, we avoid the need to hold a lock while building the map.
By building the map in a local variable and then swapping it with the member variable, we avoid the need to hold a lock while building the map.