Skip to content

Commit

Permalink
Merge pull request #1372 from wmtan/MakeStaticsThreadLocalInTrajector…
Browse files Browse the repository at this point in the history
…yCleaning

Multithreading fixes -- Make statics thread local in TrackingTools/TrajectoryCleaning
  • Loading branch information
ktf committed Nov 10, 2013
2 parents 3fc68e2 + 8ebe041 commit bcc9213
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -37,7 +37,7 @@ void TrajectoryCleanerBySharedHits::clean( TrajectoryPointerContainer & tc) cons
//typedef boost::unordered_map<Trajectory*, int> TrajMap; // for each Trajectory it stores the number of shared hits
typedef cmsutil::UnsortedDumbVectorMap<Trajectory*, int> TrajMap;

static RecHitMap theRecHitMap(128,256,1024);// allocate 128 buckets, one row for 256 keys and one row for 512 values
thread_local static RecHitMap theRecHitMap(128,256,1024);// allocate 128 buckets, one row for 256 keys and one row for 512 values
theRecHitMap.clear(10*tc.size()); // set 10*tc.size() active buckets
// numbers are not optimized

Expand All @@ -59,7 +59,7 @@ void TrajectoryCleanerBySharedHits::clean( TrajectoryPointerContainer & tc) cons

DEBUG_PRINT(std::cout << "Using RecHit map" << std::endl);
// for each trajectory fill theTrajMap
static TrajMap theTrajMap;
thread_local static TrajMap theTrajMap;
for (TrajectoryCleaner::TrajectoryPointerIterator
itt = tc.begin(); itt != tc.end(); ++itt) {
if((*itt)->isValid()){
Expand Down

0 comments on commit bcc9213

Please sign in to comment.