Better macro support for switching on/off use of mutex

This commit is contained in:
Robert Osfield
2004-08-03 11:01:39 +00:00
parent cf41e73ccc
commit 7126ca44e9
10 changed files with 74 additions and 27 deletions

View File

@@ -18,6 +18,11 @@
#include <list>
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
#include <OpenThreads/ScopedLock>
#include <OpenThreads/Mutex>
#endif
using namespace osg;
// static cache of deleted fragment programs which can only
@@ -26,14 +31,16 @@ using namespace osg;
typedef std::list<GLuint> FragmentProgramObjectList;
typedef std::map<unsigned int,FragmentProgramObjectList> DeletedFragmentProgramObjectCache;
static OpenThreads::Mutex s_mutex_deletedFragmentProgramObjectCache;
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
static OpenThreads::Mutex s_mutex_deletedFragmentProgramObjectCache;
#endif
static DeletedFragmentProgramObjectCache s_deletedFragmentProgramObjectCache;
void FragmentProgram::deleteFragmentProgramObject(unsigned int contextID,GLuint handle)
{
if (handle!=0)
{
#ifdef THREAD_SAFE_DELETE_LISTS
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedFragmentProgramObjectCache);
#endif
@@ -53,7 +60,7 @@ void FragmentProgram::flushDeletedFragmentProgramObjects(unsigned int contextID,
double elapsedTime = 0.0;
{
#ifdef THREAD_SAFE_DELETE_LISTS
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedFragmentProgramObjectCache);
#endif