Skip to content

Commit

Permalink
Use thread_local storage in CurrentG4Track
Browse files Browse the repository at this point in the history
Feels dirty, but by far the easiest solution given everything was
static already.
  • Loading branch information
makortel committed Jul 3, 2014
1 parent d87406c commit fb78455
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions SimG4Core/Notification/interface/CurrentG4Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class CurrentG4Track
static int id() { check(); return m_track->GetTrackID(); }
static const G4Track * track() { check(); return m_track; }
private:
static const G4Track * m_track;
static bool m_tracking;
static thread_local const G4Track * m_track;
static thread_local bool m_tracking;
static void setTrack(const G4Track *);
static void postTracking(const G4Track *);
static void check()
Expand Down
4 changes: 2 additions & 2 deletions SimG4Core/Notification/src/CurrentG4Track.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "SimG4Core/Notification/interface/CurrentG4Track.h"

const G4Track * CurrentG4Track::m_track = 0;
bool CurrentG4Track::m_tracking = false;
thread_local const G4Track * CurrentG4Track::m_track = 0;
thread_local bool CurrentG4Track::m_tracking = false;

void CurrentG4Track::setTrack(const G4Track * t)
{
Expand Down

0 comments on commit fb78455

Please sign in to comment.