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

@@ -31,6 +31,11 @@
#include <list>
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
#include <OpenThreads/ScopedLock>
#include <OpenThreads/Mutex>
#endif
using namespace osgGL2;
@@ -76,14 +81,16 @@ private:
typedef std::list<GLhandleARB> GL2ObjectList;
typedef std::map<unsigned int, GL2ObjectList> DeletedGL2ObjectCache;
static OpenThreads::Mutex s_mutex_deletedGL2ObjectCache;
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
static OpenThreads::Mutex s_mutex_deletedGL2ObjectCache;
#endif
static DeletedGL2ObjectCache s_deletedGL2ObjectCache;
void ProgramObject::deleteObject(unsigned int contextID, GLhandleARB handle)
{
if (handle!=0)
{
#ifdef THREAD_SAFE_DELETE_LISTS
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedGL2ObjectCache);
#endif
// add handle to the cache for the appropriate context.
@@ -101,7 +108,7 @@ void ProgramObject::flushDeletedGL2Objects(unsigned int contextID,double /*curre
double elapsedTime = 0.0;
{
#ifdef THREAD_SAFE_DELETE_LISTS
#ifdef THREAD_SAFE_GLOBJECT_DELETE_LISTS
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedGL2ObjectCache);
#endif