Better macro support for switching on/off use of mutex
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user