Skip to content
Snippets Groups Projects
Commit e0a3cd29 authored by Russell Taylor's avatar Russell Taylor
Browse files

Re #6547. Check that map has been fully filled.

Just checking that it's not empty can mean that filling it is in
progress, so we need to enter the critical block if that's the case.
This shouldn't have much (any?) performance implication as size(),
like empty(), takes constant time.
parent 2f1f0486
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,9 @@ namespace DataObjects
*/
const std::string typeFromName(const std::string & name)
{
if(TYPE_INDEX.empty())
// We should enter the critical section if the map has not been fully filled.
// Be sure to keep the value tested against in sync with the number of inserts below
if( TYPE_INDEX.size() != 17 )
{
PARALLEL_CRITICAL(fill_column_index_map)
{
......@@ -52,6 +54,7 @@ namespace DataObjects
TYPE_INDEX.insert(std::make_pair("Col", "double"));
TYPE_INDEX.insert(std::make_pair("QLab", "V3D"));
TYPE_INDEX.insert(std::make_pair("QSample", "V3D"));
// If adding an entry, be sure to increment the size comparizon in the first line
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment