Removed redundent Referenced::s/getThreadSafeReferenceCounting() and associated static and env vars as there are now inapprorpiate and no longer supported

This commit is contained in:
Robert Osfield
2016-08-26 17:59:30 +01:00
parent f9172a000e
commit 11ddd53eb4
4 changed files with 2 additions and 49 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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<DeleteHandler> 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

View File

@@ -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();