Skip to content

Commit

Permalink
Merge pull request #3756 from wmtan/ConcurrentUnorderedMap
Browse files Browse the repository at this point in the history
Use concurrent unordered map for thread safety
  • Loading branch information
davidlt committed May 8, 2014
2 parents 8e25092 + e6043bc commit 57a35ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions FWCore/Utilities/BuildFile.xml
Expand Up @@ -3,6 +3,7 @@
<use name="boost_regex"/>
<use name="rootcore"/>
<use name="libuuid"/>
<use name="tbb"/>
<export>
<lib name="1"/>
</export>
5 changes: 3 additions & 2 deletions FWCore/Utilities/src/TypeWithDict.cc
Expand Up @@ -18,6 +18,8 @@

#include "boost/thread/tss.hpp"

#include "tbb/concurrent_unordered_map.h"

#include <cassert>
#include <cstdio>
#include <cstdlib>
Expand All @@ -35,8 +37,7 @@ namespace edm {
// ignores those properties, so we must store them
// separately.

// Yes, I know this is not thread safe
typedef std::map<std::string, TypeWithDict> TypeMap;
typedef tbb::concurrent_unordered_map<std::string, TypeWithDict> TypeMap;
static TypeMap typeMap;
TypeMap::const_iterator it = typeMap.find(name);
if(it != typeMap.end()) {
Expand Down

0 comments on commit 57a35ee

Please sign in to comment.