diff --git a/include/osg/Referenced b/include/osg/Referenced index 97823af81..8eef3d358 100644 --- a/include/osg/Referenced +++ b/include/osg/Referenced @@ -117,12 +117,6 @@ class OSG_EXPORT Referenced public: - /** Set whether reference counting should use a mutex for thread safe reference counting.*/ - static void setThreadSafeReferenceCounting(bool enableThreadSafeReferenceCounting); - - /** Get whether reference counting is active.*/ - static bool getThreadSafeReferenceCounting(); - friend class DeleteHandler; /** Set a DeleteHandler to which deletion of all referenced counted objects diff --git a/src/osg/CMakeLists.txt b/src/osg/CMakeLists.txt index 2564f4c5c..7df405dfb 100644 --- a/src/osg/CMakeLists.txt +++ b/src/osg/CMakeLists.txt @@ -427,15 +427,6 @@ SET(TARGET_SRC ${OPENSCENEGRAPH_VERSIONINFO_RC} ) -################################################################################ -## Quieten warnings that a due to optional code paths - -IF(CMAKE_COMPILER_IS_GNUCXX) - # Remove -Wextra flag as it barfs on ffmoeg headers - STRING(REGEX REPLACE "-Wextra" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -ENDIF() - - SET(TARGET_LIBRARIES OpenThreads) diff --git a/src/osg/Referenced.cpp b/src/osg/Referenced.cpp index cedc391d4..07a10933f 100644 --- a/src/osg/Referenced.cpp +++ b/src/osg/Referenced.cpp @@ -97,32 +97,9 @@ struct InitGlobalMutexes }; static InitGlobalMutexes s_initGlobalMutexes; - -#if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) -static bool s_useThreadSafeReferenceCounting = getenv("OSG_THREAD_SAFE_REF_UNREF")!=0; -#endif // static std::auto_ptr s_deleteHandler(0); static DeleteHandlerPointer s_deleteHandler(0); -static ApplicationUsageProxy Referenced_e0(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_THREAD_SAFE_REF_UNREF",""); - -void Referenced::setThreadSafeReferenceCounting(bool enableThreadSafeReferenceCounting) -{ -#if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - s_useThreadSafeReferenceCounting = enableThreadSafeReferenceCounting; -#endif -} - -bool Referenced::getThreadSafeReferenceCounting() -{ -#if defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) - return true; -#else - return s_useThreadSafeReferenceCounting; -#endif -} - - void Referenced::setDeleteHandler(DeleteHandler* handler) { s_deleteHandler.reset(handler); @@ -153,10 +130,7 @@ Referenced::Referenced(): #endif { #if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) -#ifndef ENFORCE_THREADSAFE - if (s_useThreadSafeReferenceCounting) -#endif - _refMutex = new OpenThreads::Mutex; + _refMutex = new OpenThreads::Mutex; #endif #ifdef DEBUG_OBJECT_ALLOCATION_DESTRUCTION @@ -206,10 +180,7 @@ Referenced::Referenced(const Referenced&): #endif { #if !defined(_OSG_REFERENCED_USE_ATOMIC_OPERATIONS) -#ifndef ENFORCE_THREADSAFE - if (s_useThreadSafeReferenceCounting) -#endif - _refMutex = new OpenThreads::Mutex; + _refMutex = new OpenThreads::Mutex; #endif #ifdef DEBUG_OBJECT_ALLOCATION_DESTRUCTION diff --git a/src/osgViewer/ViewerBase.cpp b/src/osgViewer/ViewerBase.cpp index 05ce7d662..9642a7a4d 100644 --- a/src/osgViewer/ViewerBase.cpp +++ b/src/osgViewer/ViewerBase.cpp @@ -307,9 +307,6 @@ void ViewerBase::startThreading() return; } - // using multi-threading so make sure that new objects are allocated with thread safe ref/unref - osg::Referenced::setThreadSafeReferenceCounting(true); - Scenes scenes; getScenes(scenes); for(Scenes::iterator scitr = scenes.begin();