Skip to content
Snippets Groups Projects
Commit cc7d9214 authored by Richard Linden's avatar Richard Linden
Browse files

SH-4080 WIP interesting: random crash on Mac

removed unused dll support from llinstancetracker as it didn't appear to be thread safe
parent 04d0d5a3
No related branches found
No related tags found
No related merge requests found
...@@ -34,22 +34,6 @@ ...@@ -34,22 +34,6 @@
// external library headers // external library headers
// other Linden headers // other Linden headers
//static
void * & LLInstanceTrackerBase::getInstances(std::type_info const & info)
{
typedef std::map<std::string, void *> InstancesMap;
static InstancesMap instances;
// std::map::insert() is just what we want here. You attempt to insert a
// (key, value) pair. If the specified key doesn't yet exist, it inserts
// the pair and returns a std::pair of (iterator, true). If the specified
// key DOES exist, insert() simply returns (iterator, false). One lookup
// handles both cases.
return instances.insert(InstancesMap::value_type(info.name(),
InstancesMap::mapped_type()))
.first->second;
}
void LLInstanceTrackerBase::StaticBase::incrementDepth() void LLInstanceTrackerBase::StaticBase::incrementDepth()
{ {
apr_atomic_inc32(&sIterationNestDepth); apr_atomic_inc32(&sIterationNestDepth);
......
...@@ -46,22 +46,6 @@ ...@@ -46,22 +46,6 @@
class LL_COMMON_API LLInstanceTrackerBase : public boost::noncopyable class LL_COMMON_API LLInstanceTrackerBase : public boost::noncopyable
{ {
protected: protected:
/// Get a process-unique void* pointer slot for the specified type_info
static void * & getInstances(std::type_info const & info);
/// Find or create a STATICDATA instance for the specified TRACKED class.
/// STATICDATA must be default-constructible.
template<typename STATICDATA, class TRACKED>
static STATICDATA& getStatic()
{
void *& instances = getInstances(typeid(TRACKED));
if (! instances)
{
instances = new STATICDATA;
}
return *static_cast<STATICDATA*>(instances);
}
/// It's not essential to derive your STATICDATA (for use with /// It's not essential to derive your STATICDATA (for use with
/// getStatic()) from StaticBase; it's just that both known /// getStatic()) from StaticBase; it's just that both known
/// implementations do. /// implementations do.
...@@ -92,7 +76,7 @@ class LLInstanceTracker : public LLInstanceTrackerBase ...@@ -92,7 +76,7 @@ class LLInstanceTracker : public LLInstanceTrackerBase
{ {
InstanceMap sMap; InstanceMap sMap;
}; };
static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT>(); } static StaticData& getStatic() { static StaticData sData; return sData;}
static InstanceMap& getMap_() { return getStatic().sMap; } static InstanceMap& getMap_() { return getStatic().sMap; }
public: public:
...@@ -240,7 +224,7 @@ class LLInstanceTracker<T, void> : public LLInstanceTrackerBase ...@@ -240,7 +224,7 @@ class LLInstanceTracker<T, void> : public LLInstanceTrackerBase
{ {
InstanceSet sSet; InstanceSet sSet;
}; };
static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT>(); } static StaticData& getStatic() { static StaticData sData; return sData; }
static InstanceSet& getSet_() { return getStatic().sSet; } static InstanceSet& getSet_() { return getStatic().sSet; }
public: public:
......
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