Browse Source

general: switch to C++11 Lockable semantics for mutexes

This renames acquire/release to lock/unlock in order to be compatible with std::lock_guard and std::unique_lock (which will eventually replace the *MutexHolder classes).  It will also allow us to typedef MutexImpl to std::mutex later on.
rdb 7 years ago
parent
commit
f45ddcab2f
55 changed files with 624 additions and 469 deletions
  1. 5 5
      dtool/src/dtoolbase/deletedBufferChain.cxx
  2. 22 22
      dtool/src/dtoolbase/memoryHook.cxx
  3. 3 3
      dtool/src/dtoolbase/mutexDummyImpl.I
  4. 3 3
      dtool/src/dtoolbase/mutexDummyImpl.h
  5. 12 28
      dtool/src/dtoolbase/mutexPosixImpl.I
  6. 6 10
      dtool/src/dtoolbase/mutexPosixImpl.h
  7. 4 4
      dtool/src/dtoolbase/mutexSpinlockImpl.I
  8. 3 3
      dtool/src/dtoolbase/mutexSpinlockImpl.h
  9. 3 3
      dtool/src/dtoolbase/mutexWin32Impl.I
  10. 3 3
      dtool/src/dtoolbase/mutexWin32Impl.h
  11. 2 2
      dtool/src/dtoolbase/neverFreeMemory.I
  12. 3 3
      dtool/src/dtoolbase/neverFreeMemory.cxx
  13. 44 44
      dtool/src/dtoolbase/typeRegistry.cxx
  14. 2 2
      dtool/src/prc/configVariableFilename.cxx
  15. 2 2
      dtool/src/prc/configVariableString.cxx
  16. 2 2
      dtool/src/prc/streamWrapper.I
  17. 8 8
      panda/src/downloader/multiplexStreamBuf.cxx
  18. 4 4
      panda/src/downloader/virtualFileMountHTTP.cxx
  19. 2 2
      panda/src/event/asyncFuture.cxx
  20. 2 2
      panda/src/event/asyncTask.cxx
  21. 6 6
      panda/src/event/asyncTaskChain.cxx
  22. 2 2
      panda/src/event/asyncTaskManager.cxx
  23. 2 2
      panda/src/express/trueClock.I
  24. 48 48
      panda/src/express/virtualFileMountRamdisk.cxx
  25. 37 37
      panda/src/express/virtualFileSystem.cxx
  26. 1 1
      panda/src/express/virtualFileSystem.h
  27. 4 4
      panda/src/express/weakPointerTo.I
  28. 6 6
      panda/src/express/weakReferenceList.cxx
  29. 2 2
      panda/src/gobj/adaptiveLru.cxx
  30. 2 2
      panda/src/gobj/simpleLru.cxx
  31. 2 2
      panda/src/gobj/texture.cxx
  32. 13 13
      panda/src/pipeline/conditionVarDebug.cxx
  33. 16 16
      panda/src/pipeline/conditionVarFullDebug.cxx
  34. 4 4
      panda/src/pipeline/conditionVarSimpleImpl.cxx
  35. 32 2
      panda/src/pipeline/lightMutexDirect.I
  36. 7 2
      panda/src/pipeline/lightMutexDirect.h
  37. 46 8
      panda/src/pipeline/lightReMutexDirect.I
  38. 8 3
      panda/src/pipeline/lightReMutexDirect.h
  39. 49 12
      panda/src/pipeline/mutexDebug.I
  40. 9 9
      panda/src/pipeline/mutexDebug.cxx
  41. 8 3
      panda/src/pipeline/mutexDebug.h
  42. 33 3
      panda/src/pipeline/mutexDirect.I
  43. 6 1
      panda/src/pipeline/mutexDirect.h
  44. 8 22
      panda/src/pipeline/mutexSimpleImpl.I
  45. 3 3
      panda/src/pipeline/mutexSimpleImpl.cxx
  46. 8 9
      panda/src/pipeline/mutexSimpleImpl.h
  47. 19 19
      panda/src/pipeline/pipeline.cxx
  48. 45 15
      panda/src/pipeline/reMutexDirect.I
  49. 14 14
      panda/src/pipeline/reMutexDirect.cxx
  50. 11 6
      panda/src/pipeline/reMutexDirect.h
  51. 4 4
      panda/src/pipeline/test_mutex.cxx
  52. 15 15
      panda/src/pipeline/threadPosixImpl.cxx
  53. 13 13
      panda/src/pipeline/threadWin32Impl.cxx
  54. 2 2
      panda/src/putil/bamCache.cxx
  55. 4 4
      panda/src/putil/copyOnWritePointer.cxx

+ 5 - 5
dtool/src/dtoolbase/deletedBufferChain.cxx

@@ -43,11 +43,11 @@ allocate(size_t size, TypeHandle type_handle) {
 
 
   ObjectNode *obj;
   ObjectNode *obj;
 
 
-  _lock.acquire();
+  _lock.lock();
   if (_deleted_chain != (ObjectNode *)NULL) {
   if (_deleted_chain != (ObjectNode *)NULL) {
     obj = _deleted_chain;
     obj = _deleted_chain;
     _deleted_chain = _deleted_chain->_next;
     _deleted_chain = _deleted_chain->_next;
-    _lock.release();
+    _lock.unlock();
 
 
 #ifdef USE_DELETEDCHAINFLAG
 #ifdef USE_DELETEDCHAINFLAG
     assert(obj->_flag == (AtomicAdjust::Integer)DCF_deleted);
     assert(obj->_flag == (AtomicAdjust::Integer)DCF_deleted);
@@ -64,7 +64,7 @@ allocate(size_t size, TypeHandle type_handle) {
 
 
     return ptr;
     return ptr;
   }
   }
-  _lock.release();
+  _lock.unlock();
 
 
   // If we get here, the deleted_chain is empty; we have to allocate a new
   // If we get here, the deleted_chain is empty; we have to allocate a new
   // object from the system pool.
   // object from the system pool.
@@ -126,12 +126,12 @@ deallocate(void *ptr, TypeHandle type_handle) {
   assert(orig_flag == (AtomicAdjust::Integer)DCF_alive);
   assert(orig_flag == (AtomicAdjust::Integer)DCF_alive);
 #endif  // USE_DELETEDCHAINFLAG
 #endif  // USE_DELETEDCHAINFLAG
 
 
-  _lock.acquire();
+  _lock.lock();
 
 
   obj->_next = _deleted_chain;
   obj->_next = _deleted_chain;
   _deleted_chain = obj;
   _deleted_chain = obj;
 
 
-  _lock.release();
+  _lock.unlock();
 
 
 #else  // USE_DELETED_CHAIN
 #else  // USE_DELETED_CHAIN
   PANDA_FREE_SINGLE(ptr);
   PANDA_FREE_SINGLE(ptr);

+ 22 - 22
dtool/src/dtoolbase/memoryHook.cxx

@@ -223,9 +223,9 @@ MemoryHook(const MemoryHook &copy) :
   _total_mmap_size(copy._total_mmap_size),
   _total_mmap_size(copy._total_mmap_size),
   _max_heap_size(copy._max_heap_size) {
   _max_heap_size(copy._max_heap_size) {
 
 
-  copy._lock.acquire();
+  copy._lock.lock();
   _deleted_chains = copy._deleted_chains;
   _deleted_chains = copy._deleted_chains;
-  copy._lock.release();
+  copy._lock.unlock();
 }
 }
 
 
 /**
 /**
@@ -249,9 +249,9 @@ heap_alloc_single(size_t size) {
   size_t inflated_size = inflate_size(size);
   size_t inflated_size = inflate_size(size);
 
 
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-  _lock.acquire();
+  _lock.lock();
   void *alloc = call_malloc(inflated_size);
   void *alloc = call_malloc(inflated_size);
-  _lock.release();
+  _lock.unlock();
 #else
 #else
   void *alloc = call_malloc(inflated_size);
   void *alloc = call_malloc(inflated_size);
 #endif
 #endif
@@ -259,9 +259,9 @@ heap_alloc_single(size_t size) {
   while (alloc == (void *)NULL) {
   while (alloc == (void *)NULL) {
     alloc_fail(inflated_size);
     alloc_fail(inflated_size);
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-    _lock.acquire();
+    _lock.lock();
     alloc = call_malloc(inflated_size);
     alloc = call_malloc(inflated_size);
-    _lock.release();
+    _lock.unlock();
 #else
 #else
     alloc = call_malloc(inflated_size);
     alloc = call_malloc(inflated_size);
 #endif
 #endif
@@ -305,9 +305,9 @@ heap_free_single(void *ptr) {
 #endif  // DO_MEMORY_USAGE
 #endif  // DO_MEMORY_USAGE
 
 
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-  _lock.acquire();
+  _lock.lock();
   call_free(alloc);
   call_free(alloc);
-  _lock.release();
+  _lock.unlock();
 #else
 #else
   call_free(alloc);
   call_free(alloc);
 #endif
 #endif
@@ -326,9 +326,9 @@ heap_alloc_array(size_t size) {
   size_t inflated_size = inflate_size(size);
   size_t inflated_size = inflate_size(size);
 
 
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-  _lock.acquire();
+  _lock.lock();
   void *alloc = call_malloc(inflated_size);
   void *alloc = call_malloc(inflated_size);
-  _lock.release();
+  _lock.unlock();
 #else
 #else
   void *alloc = call_malloc(inflated_size);
   void *alloc = call_malloc(inflated_size);
 #endif
 #endif
@@ -336,9 +336,9 @@ heap_alloc_array(size_t size) {
   while (alloc == (void *)NULL) {
   while (alloc == (void *)NULL) {
     alloc_fail(inflated_size);
     alloc_fail(inflated_size);
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-    _lock.acquire();
+    _lock.lock();
     alloc = call_malloc(inflated_size);
     alloc = call_malloc(inflated_size);
-    _lock.release();
+    _lock.unlock();
 #else
 #else
     alloc = call_malloc(inflated_size);
     alloc = call_malloc(inflated_size);
 #endif
 #endif
@@ -380,9 +380,9 @@ heap_realloc_array(void *ptr, size_t size) {
 
 
   void *alloc1 = alloc;
   void *alloc1 = alloc;
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-  _lock.acquire();
+  _lock.lock();
   alloc1 = call_realloc(alloc1, inflated_size);
   alloc1 = call_realloc(alloc1, inflated_size);
-  _lock.release();
+  _lock.unlock();
 #else
 #else
   alloc1 = call_realloc(alloc1, inflated_size);
   alloc1 = call_realloc(alloc1, inflated_size);
 #endif
 #endif
@@ -394,9 +394,9 @@ heap_realloc_array(void *ptr, size_t size) {
     alloc1 = alloc;
     alloc1 = alloc;
 
 
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-    _lock.acquire();
+    _lock.lock();
     alloc1 = call_realloc(alloc1, inflated_size);
     alloc1 = call_realloc(alloc1, inflated_size);
-    _lock.release();
+    _lock.unlock();
 #else
 #else
     alloc1 = call_realloc(alloc1, inflated_size);
     alloc1 = call_realloc(alloc1, inflated_size);
 #endif
 #endif
@@ -453,9 +453,9 @@ heap_free_array(void *ptr) {
 #endif  // DO_MEMORY_USAGE
 #endif  // DO_MEMORY_USAGE
 
 
 #ifdef MEMORY_HOOK_MALLOC_LOCK
 #ifdef MEMORY_HOOK_MALLOC_LOCK
-  _lock.acquire();
+  _lock.lock();
   call_free(alloc);
   call_free(alloc);
-  _lock.release();
+  _lock.unlock();
 #else
 #else
   call_free(alloc);
   call_free(alloc);
 #endif
 #endif
@@ -478,11 +478,11 @@ heap_trim(size_t pad) {
   // Since malloc_trim() isn't standard C, we can't be sure it exists on a
   // Since malloc_trim() isn't standard C, we can't be sure it exists on a
   // given platform.  But if we're using dlmalloc, we know we have
   // given platform.  But if we're using dlmalloc, we know we have
   // dlmalloc_trim.
   // dlmalloc_trim.
-  _lock.acquire();
+  _lock.lock();
   if (dlmalloc_trim(pad)) {
   if (dlmalloc_trim(pad)) {
     trimmed = true;
     trimmed = true;
   }
   }
-  _lock.release();
+  _lock.unlock();
 #endif
 #endif
 
 
 #ifdef WIN32
 #ifdef WIN32
@@ -596,7 +596,7 @@ DeletedBufferChain *MemoryHook::
 get_deleted_chain(size_t buffer_size) {
 get_deleted_chain(size_t buffer_size) {
   DeletedBufferChain *chain;
   DeletedBufferChain *chain;
 
 
-  _lock.acquire();
+  _lock.lock();
   DeletedChains::iterator dci = _deleted_chains.find(buffer_size);
   DeletedChains::iterator dci = _deleted_chains.find(buffer_size);
   if (dci != _deleted_chains.end()) {
   if (dci != _deleted_chains.end()) {
     chain = (*dci).second;
     chain = (*dci).second;
@@ -606,7 +606,7 @@ get_deleted_chain(size_t buffer_size) {
     _deleted_chains.insert(DeletedChains::value_type(buffer_size, chain));
     _deleted_chains.insert(DeletedChains::value_type(buffer_size, chain));
   }
   }
 
 
-  _lock.release();
+  _lock.unlock();
   return chain;
   return chain;
 }
 }
 
 

+ 3 - 3
dtool/src/dtoolbase/mutexDummyImpl.I

@@ -15,14 +15,14 @@
  *
  *
  */
  */
 ALWAYS_INLINE void MutexDummyImpl::
 ALWAYS_INLINE void MutexDummyImpl::
-acquire() {
+lock() {
 }
 }
 
 
 /**
 /**
  *
  *
  */
  */
 ALWAYS_INLINE bool MutexDummyImpl::
 ALWAYS_INLINE bool MutexDummyImpl::
-try_acquire() {
+try_lock() {
   return true;
   return true;
 }
 }
 
 
@@ -30,5 +30,5 @@ try_acquire() {
  *
  *
  */
  */
 ALWAYS_INLINE void MutexDummyImpl::
 ALWAYS_INLINE void MutexDummyImpl::
-release() {
+unlock() {
 }
 }

+ 3 - 3
dtool/src/dtoolbase/mutexDummyImpl.h

@@ -30,9 +30,9 @@ private:
   MutexDummyImpl &operator = (const MutexDummyImpl &copy) DELETED_ASSIGN;
   MutexDummyImpl &operator = (const MutexDummyImpl &copy) DELETED_ASSIGN;
 
 
 public:
 public:
-  ALWAYS_INLINE void acquire();
-  ALWAYS_INLINE bool try_acquire();
-  ALWAYS_INLINE void release();
+  ALWAYS_INLINE void lock();
+  ALWAYS_INLINE bool try_lock();
+  ALWAYS_INLINE void unlock();
 };
 };
 
 
 #include "mutexDummyImpl.I"
 #include "mutexDummyImpl.I"

+ 12 - 28
dtool/src/dtoolbase/mutexPosixImpl.I

@@ -32,8 +32,8 @@ INLINE MutexPosixImpl::
  *
  *
  */
  */
 INLINE void MutexPosixImpl::
 INLINE void MutexPosixImpl::
-acquire() {
-  TAU_PROFILE("void MutexPosixImpl::acquire", " ", TAU_USER);
+lock() {
+  TAU_PROFILE("void MutexPosixImpl::lock", " ", TAU_USER);
   int result = pthread_mutex_lock(&_lock);
   int result = pthread_mutex_lock(&_lock);
   assert(result == 0);
   assert(result == 0);
 }
 }
@@ -42,8 +42,8 @@ acquire() {
  *
  *
  */
  */
 INLINE bool MutexPosixImpl::
 INLINE bool MutexPosixImpl::
-try_acquire() {
-  TAU_PROFILE("bool MutexPosixImpl::try_acquire", " ", TAU_USER);
+try_lock() {
+  TAU_PROFILE("bool MutexPosixImpl::try_lock", " ", TAU_USER);
   int result = pthread_mutex_trylock(&_lock);
   int result = pthread_mutex_trylock(&_lock);
   assert(result == 0 || result == EBUSY);
   assert(result == 0 || result == EBUSY);
   return (result == 0);
   return (result == 0);
@@ -53,20 +53,12 @@ try_acquire() {
  *
  *
  */
  */
 INLINE void MutexPosixImpl::
 INLINE void MutexPosixImpl::
-release() {
-  TAU_PROFILE("void MutexPosixImpl::release", " ", TAU_USER);
+unlock() {
+  TAU_PROFILE("void MutexPosixImpl::unlock", " ", TAU_USER);
   int result = pthread_mutex_unlock(&_lock);
   int result = pthread_mutex_unlock(&_lock);
   assert(result == 0);
   assert(result == 0);
 }
 }
 
 
-/**
- * Returns the underlying Posix lock handle.
- */
-INLINE pthread_mutex_t *MutexPosixImpl::
-get_posix_lock() {
-  return &_lock;
-}
-
 /**
 /**
  *
  *
  */
  */
@@ -101,8 +93,8 @@ INLINE ReMutexPosixImpl::
  *
  *
  */
  */
 INLINE void ReMutexPosixImpl::
 INLINE void ReMutexPosixImpl::
-acquire() {
-  TAU_PROFILE("void ReMutexPosixImpl::acquire", " ", TAU_USER);
+lock() {
+  TAU_PROFILE("void ReMutexPosixImpl::lock", " ", TAU_USER);
   int result = pthread_mutex_lock(&_lock);
   int result = pthread_mutex_lock(&_lock);
   assert(result == 0);
   assert(result == 0);
 }
 }
@@ -111,8 +103,8 @@ acquire() {
  *
  *
  */
  */
 INLINE bool ReMutexPosixImpl::
 INLINE bool ReMutexPosixImpl::
-try_acquire() {
-  TAU_PROFILE("bool ReMutexPosixImpl::try_acquire", " ", TAU_USER);
+try_lock() {
+  TAU_PROFILE("bool ReMutexPosixImpl::try_lock", " ", TAU_USER);
   int result = pthread_mutex_trylock(&_lock);
   int result = pthread_mutex_trylock(&_lock);
   assert(result == 0 || result == EBUSY);
   assert(result == 0 || result == EBUSY);
   return (result == 0);
   return (result == 0);
@@ -122,16 +114,8 @@ try_acquire() {
  *
  *
  */
  */
 INLINE void ReMutexPosixImpl::
 INLINE void ReMutexPosixImpl::
-release() {
-  TAU_PROFILE("void ReMutexPosixImpl::release", " ", TAU_USER);
+unlock() {
+  TAU_PROFILE("void ReMutexPosixImpl::unlock", " ", TAU_USER);
   int result = pthread_mutex_unlock(&_lock);
   int result = pthread_mutex_unlock(&_lock);
   assert(result == 0);
   assert(result == 0);
 }
 }
-
-/**
- * Returns the underlying Posix lock handle.
- */
-INLINE pthread_mutex_t *ReMutexPosixImpl::
-get_posix_lock() {
-  return &_lock;
-}

+ 6 - 10
dtool/src/dtoolbase/mutexPosixImpl.h

@@ -36,11 +36,9 @@ private:
   MutexPosixImpl &operator = (const MutexPosixImpl &copy) DELETED_ASSIGN;
   MutexPosixImpl &operator = (const MutexPosixImpl &copy) DELETED_ASSIGN;
 
 
 public:
 public:
-  INLINE void acquire();
-  INLINE bool try_acquire();
-  INLINE void release();
-
-  INLINE pthread_mutex_t *get_posix_lock();
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
 
 
 private:
 private:
   pthread_mutex_t _lock;
   pthread_mutex_t _lock;
@@ -64,11 +62,9 @@ private:
   ReMutexPosixImpl &operator = (const ReMutexPosixImpl &copy) DELETED;
   ReMutexPosixImpl &operator = (const ReMutexPosixImpl &copy) DELETED;
 
 
 public:
 public:
-  INLINE void acquire();
-  INLINE bool try_acquire();
-  INLINE void release();
-
-  INLINE pthread_mutex_t *get_posix_lock();
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
 
 
 private:
 private:
   pthread_mutex_t _lock;
   pthread_mutex_t _lock;

+ 4 - 4
dtool/src/dtoolbase/mutexSpinlockImpl.I

@@ -22,8 +22,8 @@ MutexSpinlockImpl() : _lock(0) {
  *
  *
  */
  */
 INLINE void MutexSpinlockImpl::
 INLINE void MutexSpinlockImpl::
-acquire() {
-  if (!try_acquire()) {
+lock() {
+  if (!try_lock()) {
     do_lock();
     do_lock();
   }
   }
 }
 }
@@ -32,7 +32,7 @@ acquire() {
  *
  *
  */
  */
 INLINE bool MutexSpinlockImpl::
 INLINE bool MutexSpinlockImpl::
-try_acquire() {
+try_lock() {
   return (AtomicAdjust::compare_and_exchange(_lock, 0, 1) == 0);
   return (AtomicAdjust::compare_and_exchange(_lock, 0, 1) == 0);
 }
 }
 
 
@@ -40,6 +40,6 @@ try_acquire() {
  *
  *
  */
  */
 INLINE void MutexSpinlockImpl::
 INLINE void MutexSpinlockImpl::
-release() {
+unlock() {
   AtomicAdjust::set(_lock, 0);
   AtomicAdjust::set(_lock, 0);
 }
 }

+ 3 - 3
dtool/src/dtoolbase/mutexSpinlockImpl.h

@@ -36,9 +36,9 @@ private:
   MutexSpinlockImpl &operator = (const MutexSpinlockImpl &copy) DELETED_ASSIGN;
   MutexSpinlockImpl &operator = (const MutexSpinlockImpl &copy) DELETED_ASSIGN;
 
 
 public:
 public:
-  INLINE void acquire();
-  INLINE bool try_acquire();
-  INLINE void release();
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
 
 
 private:
 private:
   void do_lock();
   void do_lock();

+ 3 - 3
dtool/src/dtoolbase/mutexWin32Impl.I

@@ -23,7 +23,7 @@ INLINE MutexWin32Impl::
  *
  *
  */
  */
 INLINE void MutexWin32Impl::
 INLINE void MutexWin32Impl::
-acquire() {
+lock() {
   EnterCriticalSection(&_lock);
   EnterCriticalSection(&_lock);
 }
 }
 
 
@@ -31,7 +31,7 @@ acquire() {
  *
  *
  */
  */
 INLINE bool MutexWin32Impl::
 INLINE bool MutexWin32Impl::
-try_acquire() {
+try_lock() {
   return (TryEnterCriticalSection(&_lock) != 0);
   return (TryEnterCriticalSection(&_lock) != 0);
 }
 }
 
 
@@ -39,6 +39,6 @@ try_acquire() {
  *
  *
  */
  */
 INLINE void MutexWin32Impl::
 INLINE void MutexWin32Impl::
-release() {
+unlock() {
   LeaveCriticalSection(&_lock);
   LeaveCriticalSection(&_lock);
 }
 }

+ 3 - 3
dtool/src/dtoolbase/mutexWin32Impl.h

@@ -36,9 +36,9 @@ private:
   MutexWin32Impl &operator = (const MutexWin32Impl &copy) DELETED_ASSIGN;
   MutexWin32Impl &operator = (const MutexWin32Impl &copy) DELETED_ASSIGN;
 
 
 public:
 public:
-  INLINE void acquire();
-  INLINE bool try_acquire();
-  INLINE void release();
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
 
 
 private:
 private:
   CRITICAL_SECTION _lock;
   CRITICAL_SECTION _lock;

+ 2 - 2
dtool/src/dtoolbase/neverFreeMemory.I

@@ -48,9 +48,9 @@ get_total_used() {
 INLINE size_t NeverFreeMemory::
 INLINE size_t NeverFreeMemory::
 get_total_unused() {
 get_total_unused() {
   NeverFreeMemory *global_ptr = get_global_ptr();
   NeverFreeMemory *global_ptr = get_global_ptr();
-  global_ptr->_lock.acquire();
+  global_ptr->_lock.lock();
   size_t total_unused = global_ptr->_total_alloc - global_ptr->_total_used;
   size_t total_unused = global_ptr->_total_alloc - global_ptr->_total_used;
-  global_ptr->_lock.release();
+  global_ptr->_lock.unlock();
   return total_unused;
   return total_unused;
 }
 }
 
 

+ 3 - 3
dtool/src/dtoolbase/neverFreeMemory.cxx

@@ -37,7 +37,7 @@ NeverFreeMemory() {
  */
  */
 void *NeverFreeMemory::
 void *NeverFreeMemory::
 ns_alloc(size_t size) {
 ns_alloc(size_t size) {
-  _lock.acquire();
+  _lock.lock();
 
 
   //NB: we no longer do alignment here.  The only class that uses this is
   //NB: we no longer do alignment here.  The only class that uses this is
   // DeletedBufferChain, and we can do the alignment potentially more
   // DeletedBufferChain, and we can do the alignment potentially more
@@ -55,7 +55,7 @@ ns_alloc(size_t size) {
     if (page._remaining >= min_page_remaining_size) {
     if (page._remaining >= min_page_remaining_size) {
       _pages.insert(page);
       _pages.insert(page);
     }
     }
-    _lock.release();
+    _lock.unlock();
     return result;
     return result;
   }
   }
 
 
@@ -71,7 +71,7 @@ ns_alloc(size_t size) {
   if (page._remaining >= min_page_remaining_size) {
   if (page._remaining >= min_page_remaining_size) {
     _pages.insert(page);
     _pages.insert(page);
   }
   }
-  _lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 

+ 44 - 44
dtool/src/dtoolbase/typeRegistry.cxx

@@ -32,7 +32,7 @@ TypeRegistry *TypeRegistry::_global_pointer = NULL;
  */
  */
 bool TypeRegistry::
 bool TypeRegistry::
 register_type(TypeHandle &type_handle, const string &name) {
 register_type(TypeHandle &type_handle, const string &name) {
-  _lock->acquire();
+  _lock->lock();
 
 
   if (type_handle != TypeHandle::none()) {
   if (type_handle != TypeHandle::none()) {
     // Here's a type that was already registered.  Just make sure everything's
     // Here's a type that was already registered.  Just make sure everything's
@@ -40,7 +40,7 @@ register_type(TypeHandle &type_handle, const string &name) {
     TypeRegistryNode *rnode = look_up(type_handle, NULL);
     TypeRegistryNode *rnode = look_up(type_handle, NULL);
     if (&type_handle == &rnode->_ref) {
     if (&type_handle == &rnode->_ref) {
       // No problem.
       // No problem.
-      _lock->release();
+      _lock->unlock();
       assert(rnode->_name == name);
       assert(rnode->_name == name);
       return false;
       return false;
     }
     }
@@ -62,7 +62,7 @@ register_type(TypeHandle &type_handle, const string &name) {
     _derivations_fresh = false;
     _derivations_fresh = false;
 
 
     type_handle = new_handle;
     type_handle = new_handle;
-    _lock->release();
+    _lock->unlock();
     return true;
     return true;
   }
   }
   TypeRegistryNode *rnode = (*ri).second;
   TypeRegistryNode *rnode = (*ri).second;
@@ -78,7 +78,7 @@ register_type(TypeHandle &type_handle, const string &name) {
 
 
     if (type_handle == rnode->_handle) {
     if (type_handle == rnode->_handle) {
       // No problem.
       // No problem.
-      _lock->release();
+      _lock->unlock();
       return false;
       return false;
     }
     }
     // But wait--the type_handle has changed!  We kept a reference to the
     // But wait--the type_handle has changed!  We kept a reference to the
@@ -87,7 +87,7 @@ register_type(TypeHandle &type_handle, const string &name) {
     // time, but now it's different!  Bad juju.
     // time, but now it's different!  Bad juju.
     cerr << "Reregistering " << name << "\n";
     cerr << "Reregistering " << name << "\n";
     type_handle = rnode->_handle;
     type_handle = rnode->_handle;
-    _lock->release();
+    _lock->unlock();
     return false;
     return false;
   }
   }
 
 
@@ -103,7 +103,7 @@ register_type(TypeHandle &type_handle, const string &name) {
 
 
     type_handle = rnode->_handle;
     type_handle = rnode->_handle;
   }
   }
-  _lock->release();
+  _lock->unlock();
   return false;
   return false;
 }
 }
 
 
@@ -114,7 +114,7 @@ register_type(TypeHandle &type_handle, const string &name) {
  */
  */
 TypeHandle TypeRegistry::
 TypeHandle TypeRegistry::
 register_dynamic_type(const string &name) {
 register_dynamic_type(const string &name) {
-  _lock->acquire();
+  _lock->lock();
 
 
   NameRegistry::iterator ri;
   NameRegistry::iterator ri;
   ri = _name_registry.find(name);
   ri = _name_registry.find(name);
@@ -134,14 +134,14 @@ register_dynamic_type(const string &name) {
     _name_registry[name] = rnode;
     _name_registry[name] = rnode;
     _derivations_fresh = false;
     _derivations_fresh = false;
 
 
-    _lock->release();
+    _lock->unlock();
     return *new_handle;
     return *new_handle;
   }
   }
 
 
   // Return the TypeHandle previously obtained.
   // Return the TypeHandle previously obtained.
   TypeRegistryNode *rnode = (*ri).second;
   TypeRegistryNode *rnode = (*ri).second;
   TypeHandle handle = rnode->_handle;
   TypeHandle handle = rnode->_handle;
-  _lock->release();
+  _lock->unlock();
   return handle;
   return handle;
 }
 }
 
 
@@ -152,7 +152,7 @@ register_dynamic_type(const string &name) {
  */
  */
 void TypeRegistry::
 void TypeRegistry::
 record_derivation(TypeHandle child, TypeHandle parent) {
 record_derivation(TypeHandle child, TypeHandle parent) {
-  _lock->acquire();
+  _lock->lock();
 
 
   TypeRegistryNode *cnode = look_up(child, NULL);
   TypeRegistryNode *cnode = look_up(child, NULL);
   assert(cnode != (TypeRegistryNode *)NULL);
   assert(cnode != (TypeRegistryNode *)NULL);
@@ -171,7 +171,7 @@ record_derivation(TypeHandle child, TypeHandle parent) {
     _derivations_fresh = false;
     _derivations_fresh = false;
   }
   }
 
 
-  _lock->release();
+  _lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -182,7 +182,7 @@ record_derivation(TypeHandle child, TypeHandle parent) {
  */
  */
 void TypeRegistry::
 void TypeRegistry::
 record_alternate_name(TypeHandle type, const string &name) {
 record_alternate_name(TypeHandle type, const string &name) {
-  _lock->acquire();
+  _lock->lock();
 
 
   TypeRegistryNode *rnode = look_up(type, (TypedObject *)NULL);
   TypeRegistryNode *rnode = look_up(type, (TypedObject *)NULL);
   if (rnode != (TypeRegistryNode *)NULL) {
   if (rnode != (TypeRegistryNode *)NULL) {
@@ -190,7 +190,7 @@ record_alternate_name(TypeHandle type, const string &name) {
       _name_registry.insert(NameRegistry::value_type(name, rnode)).first;
       _name_registry.insert(NameRegistry::value_type(name, rnode)).first;
 
 
     if ((*ri).second != rnode) {
     if ((*ri).second != rnode) {
-      _lock->release();
+      _lock->unlock();
       cerr
       cerr
         << "Name " << name << " already assigned to TypeHandle "
         << "Name " << name << " already assigned to TypeHandle "
         << rnode->_name << "; cannot reassign to " << type << "\n";
         << rnode->_name << "; cannot reassign to " << type << "\n";
@@ -199,7 +199,7 @@ record_alternate_name(TypeHandle type, const string &name) {
 
 
   }
   }
 
 
-  _lock->release();
+  _lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -208,7 +208,7 @@ record_alternate_name(TypeHandle type, const string &name) {
  */
  */
 TypeHandle TypeRegistry::
 TypeHandle TypeRegistry::
 find_type(const string &name) const {
 find_type(const string &name) const {
-  _lock->acquire();
+  _lock->lock();
 
 
   TypeHandle handle = TypeHandle::none();
   TypeHandle handle = TypeHandle::none();
   NameRegistry::const_iterator ri;
   NameRegistry::const_iterator ri;
@@ -216,7 +216,7 @@ find_type(const string &name) const {
   if (ri != _name_registry.end()) {
   if (ri != _name_registry.end()) {
     handle = (*ri).second->_handle;
     handle = (*ri).second->_handle;
   }
   }
-  _lock->release();
+  _lock->unlock();
 
 
   return handle;
   return handle;
 }
 }
@@ -248,11 +248,11 @@ find_type_by_id(int id) const {
  */
  */
 string TypeRegistry::
 string TypeRegistry::
 get_name(TypeHandle type, TypedObject *object) const {
 get_name(TypeHandle type, TypedObject *object) const {
-  _lock->acquire();
+  _lock->lock();
   TypeRegistryNode *rnode = look_up(type, object);
   TypeRegistryNode *rnode = look_up(type, object);
   assert(rnode != (TypeRegistryNode *)NULL);
   assert(rnode != (TypeRegistryNode *)NULL);
   string name = rnode->_name;
   string name = rnode->_name;
-  _lock->release();
+  _lock->unlock();
 
 
   return name;
   return name;
 }
 }
@@ -273,7 +273,7 @@ get_name(TypeHandle type, TypedObject *object) const {
 bool TypeRegistry::
 bool TypeRegistry::
 is_derived_from(TypeHandle child, TypeHandle base,
 is_derived_from(TypeHandle child, TypeHandle base,
                 TypedObject *child_object) {
                 TypedObject *child_object) {
-  _lock->acquire();
+  _lock->lock();
 
 
   const TypeRegistryNode *child_node = look_up(child, child_object);
   const TypeRegistryNode *child_node = look_up(child, child_object);
   const TypeRegistryNode *base_node = look_up(base, (TypedObject *)NULL);
   const TypeRegistryNode *base_node = look_up(base, (TypedObject *)NULL);
@@ -284,7 +284,7 @@ is_derived_from(TypeHandle child, TypeHandle base,
   freshen_derivations();
   freshen_derivations();
 
 
   bool result = TypeRegistryNode::is_derived_from(child_node, base_node);
   bool result = TypeRegistryNode::is_derived_from(child_node, base_node);
-  _lock->release();
+  _lock->unlock();
   return result;
   return result;
 }
 }
 
 
@@ -293,9 +293,9 @@ is_derived_from(TypeHandle child, TypeHandle base,
  */
  */
 int TypeRegistry::
 int TypeRegistry::
 get_num_typehandles() {
 get_num_typehandles() {
-  _lock->acquire();
+  _lock->lock();
   int num_types = (int)_handle_registry.size();
   int num_types = (int)_handle_registry.size();
-  _lock->release();
+  _lock->unlock();
   return num_types;
   return num_types;
 }
 }
 
 
@@ -304,12 +304,12 @@ get_num_typehandles() {
  */
  */
 TypeHandle TypeRegistry::
 TypeHandle TypeRegistry::
 get_typehandle(int n) {
 get_typehandle(int n) {
-  _lock->acquire();
+  _lock->lock();
   TypeRegistryNode *rnode = NULL;
   TypeRegistryNode *rnode = NULL;
   if (n >= 0 && n < (int)_handle_registry.size()) {
   if (n >= 0 && n < (int)_handle_registry.size()) {
     rnode = _handle_registry[n];
     rnode = _handle_registry[n];
   }
   }
-  _lock->release();
+  _lock->unlock();
 
 
   if (rnode != (TypeRegistryNode *)NULL) {
   if (rnode != (TypeRegistryNode *)NULL) {
     return rnode->_handle;
     return rnode->_handle;
@@ -324,10 +324,10 @@ get_typehandle(int n) {
  */
  */
 int TypeRegistry::
 int TypeRegistry::
 get_num_root_classes() {
 get_num_root_classes() {
-  _lock->acquire();
+  _lock->lock();
   freshen_derivations();
   freshen_derivations();
   int num_roots = (int)_root_classes.size();
   int num_roots = (int)_root_classes.size();
-  _lock->release();
+  _lock->unlock();
   return num_roots;
   return num_roots;
 }
 }
 
 
@@ -336,7 +336,7 @@ get_num_root_classes() {
  */
  */
 TypeHandle TypeRegistry::
 TypeHandle TypeRegistry::
 get_root_class(int n) {
 get_root_class(int n) {
-  _lock->acquire();
+  _lock->lock();
   freshen_derivations();
   freshen_derivations();
   TypeHandle handle;
   TypeHandle handle;
   if (n >= 0 && n < (int)_root_classes.size()) {
   if (n >= 0 && n < (int)_root_classes.size()) {
@@ -344,7 +344,7 @@ get_root_class(int n) {
   } else {
   } else {
     handle = TypeHandle::none();
     handle = TypeHandle::none();
   }
   }
-  _lock->release();
+  _lock->unlock();
 
 
   return handle;
   return handle;
 }
 }
@@ -362,11 +362,11 @@ get_root_class(int n) {
  */
  */
 int TypeRegistry::
 int TypeRegistry::
 get_num_parent_classes(TypeHandle child, TypedObject *child_object) const {
 get_num_parent_classes(TypeHandle child, TypedObject *child_object) const {
-  _lock->acquire();
+  _lock->lock();
   TypeRegistryNode *rnode = look_up(child, child_object);
   TypeRegistryNode *rnode = look_up(child, child_object);
   assert(rnode != (TypeRegistryNode *)NULL);
   assert(rnode != (TypeRegistryNode *)NULL);
   int num_parents = (int)rnode->_parent_classes.size();
   int num_parents = (int)rnode->_parent_classes.size();
-  _lock->release();
+  _lock->unlock();
   return num_parents;
   return num_parents;
 }
 }
 
 
@@ -376,7 +376,7 @@ get_num_parent_classes(TypeHandle child, TypedObject *child_object) const {
  */
  */
 TypeHandle TypeRegistry::
 TypeHandle TypeRegistry::
 get_parent_class(TypeHandle child, int index) const {
 get_parent_class(TypeHandle child, int index) const {
-  _lock->acquire();
+  _lock->lock();
   TypeHandle handle;
   TypeHandle handle;
   TypeRegistryNode *rnode = look_up(child, (TypedObject *)NULL);
   TypeRegistryNode *rnode = look_up(child, (TypedObject *)NULL);
   assert(rnode != (TypeRegistryNode *)NULL);
   assert(rnode != (TypeRegistryNode *)NULL);
@@ -385,7 +385,7 @@ get_parent_class(TypeHandle child, int index) const {
   } else {
   } else {
     handle = TypeHandle::none();
     handle = TypeHandle::none();
   }
   }
-  _lock->release();
+  _lock->unlock();
   return handle;
   return handle;
 }
 }
 
 
@@ -399,11 +399,11 @@ get_parent_class(TypeHandle child, int index) const {
  */
  */
 int TypeRegistry::
 int TypeRegistry::
 get_num_child_classes(TypeHandle child, TypedObject *child_object) const {
 get_num_child_classes(TypeHandle child, TypedObject *child_object) const {
-  _lock->acquire();
+  _lock->lock();
   TypeRegistryNode *rnode = look_up(child, child_object);
   TypeRegistryNode *rnode = look_up(child, child_object);
   assert(rnode != (TypeRegistryNode *)NULL);
   assert(rnode != (TypeRegistryNode *)NULL);
   int num_children = (int)rnode->_child_classes.size();
   int num_children = (int)rnode->_child_classes.size();
-  _lock->release();
+  _lock->unlock();
   return num_children;
   return num_children;
 }
 }
 
 
@@ -413,7 +413,7 @@ get_num_child_classes(TypeHandle child, TypedObject *child_object) const {
  */
  */
 TypeHandle TypeRegistry::
 TypeHandle TypeRegistry::
 get_child_class(TypeHandle child, int index) const {
 get_child_class(TypeHandle child, int index) const {
-  _lock->acquire();
+  _lock->lock();
   TypeHandle handle;
   TypeHandle handle;
   TypeRegistryNode *rnode = look_up(child, (TypedObject *)NULL);
   TypeRegistryNode *rnode = look_up(child, (TypedObject *)NULL);
   assert(rnode != (TypeRegistryNode *)NULL);
   assert(rnode != (TypeRegistryNode *)NULL);
@@ -422,7 +422,7 @@ get_child_class(TypeHandle child, int index) const {
   } else {
   } else {
     handle = TypeHandle::none();
     handle = TypeHandle::none();
   }
   }
-  _lock->release();
+  _lock->unlock();
   return handle;
   return handle;
 }
 }
 
 
@@ -439,7 +439,7 @@ get_child_class(TypeHandle child, int index) const {
 TypeHandle TypeRegistry::
 TypeHandle TypeRegistry::
 get_parent_towards(TypeHandle child, TypeHandle base,
 get_parent_towards(TypeHandle child, TypeHandle base,
                    TypedObject *child_object) {
                    TypedObject *child_object) {
-  _lock->acquire();
+  _lock->lock();
   TypeHandle handle;
   TypeHandle handle;
   const TypeRegistryNode *child_node = look_up(child, child_object);
   const TypeRegistryNode *child_node = look_up(child, child_object);
   const TypeRegistryNode *base_node = look_up(base, NULL);
   const TypeRegistryNode *base_node = look_up(base, NULL);
@@ -447,7 +447,7 @@ get_parent_towards(TypeHandle child, TypeHandle base,
          base_node != (TypeRegistryNode *)NULL);
          base_node != (TypeRegistryNode *)NULL);
   freshen_derivations();
   freshen_derivations();
   handle = TypeRegistryNode::get_parent_towards(child_node, base_node);
   handle = TypeRegistryNode::get_parent_towards(child_node, base_node);
-  _lock->release();
+  _lock->unlock();
   return handle;
   return handle;
 }
 }
 
 
@@ -462,7 +462,7 @@ get_parent_towards(TypeHandle child, TypeHandle base,
 void TypeRegistry::
 void TypeRegistry::
 reregister_types() {
 reregister_types() {
   init_lock();
   init_lock();
-  _lock->acquire();
+  _lock->lock();
   HandleRegistry::iterator ri;
   HandleRegistry::iterator ri;
   TypeRegistry *reg = ptr();
   TypeRegistry *reg = ptr();
   for (ri = reg->_handle_registry.begin();
   for (ri = reg->_handle_registry.begin();
@@ -473,7 +473,7 @@ reregister_types() {
       cerr << "Reregistering " << rnode->_name << "\n";
       cerr << "Reregistering " << rnode->_name << "\n";
     }
     }
   }
   }
-  _lock->release();
+  _lock->unlock();
 }
 }
 
 
 
 
@@ -483,9 +483,9 @@ reregister_types() {
  */
  */
 void TypeRegistry::
 void TypeRegistry::
 write(ostream &out) const {
 write(ostream &out) const {
-  _lock->acquire();
+  _lock->lock();
   do_write(out);
   do_write(out);
-  _lock->release();
+  _lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -613,9 +613,9 @@ look_up_invalid(TypeHandle handle, TypedObject *object) const {
       // But we're lucky enough to have a TypedObject pointer handy!  Maybe we
       // But we're lucky enough to have a TypedObject pointer handy!  Maybe we
       // can use it to resolve the error.  We have to drop the lock while we
       // can use it to resolve the error.  We have to drop the lock while we
       // do this, so we don't get a recursive lock.
       // do this, so we don't get a recursive lock.
-      _lock->release();
+      _lock->unlock();
       handle = object->force_init_type();
       handle = object->force_init_type();
-      _lock->acquire();
+      _lock->lock();
 
 
       if (handle._index == 0) {
       if (handle._index == 0) {
         // Strange.
         // Strange.

+ 2 - 2
dtool/src/prc/configVariableFilename.cxx

@@ -23,7 +23,7 @@ reload_cache() {
   // thread-safe manner.  But chances are that the first time this is called
   // thread-safe manner.  But chances are that the first time this is called
   // is at static init time, when there is no risk of data races.
   // is at static init time, when there is no risk of data races.
   static MutexImpl lock;
   static MutexImpl lock;
-  lock.acquire();
+  lock.lock();
 
 
   // We check again for cache validity since another thread may have beaten
   // We check again for cache validity since another thread may have beaten
   // us to the punch while we were waiting for the lock.
   // us to the punch while we were waiting for the lock.
@@ -42,5 +42,5 @@ reload_cache() {
 
 
     mark_cache_valid(_local_modified);
     mark_cache_valid(_local_modified);
   }
   }
-  lock.release();
+  lock.unlock();
 }
 }

+ 2 - 2
dtool/src/prc/configVariableString.cxx

@@ -22,7 +22,7 @@ reload_cache() {
   // thread-safe manner.  But chances are that the first time this is called
   // thread-safe manner.  But chances are that the first time this is called
   // is at static init time, when there is no risk of data races.
   // is at static init time, when there is no risk of data races.
   static MutexImpl lock;
   static MutexImpl lock;
-  lock.acquire();
+  lock.lock();
 
 
   // We check again for cache validity since another thread may have beaten
   // We check again for cache validity since another thread may have beaten
   // us to the punch while we were waiting for the lock.
   // us to the punch while we were waiting for the lock.
@@ -31,5 +31,5 @@ reload_cache() {
     mark_cache_valid(_local_modified);
     mark_cache_valid(_local_modified);
   }
   }
 
 
-  lock.release();
+  lock.unlock();
 }
 }

+ 2 - 2
dtool/src/prc/streamWrapper.I

@@ -36,7 +36,7 @@ StreamWrapperBase() {
  */
  */
 INLINE void StreamWrapperBase::
 INLINE void StreamWrapperBase::
 acquire() {
 acquire() {
-  _lock.acquire();
+  _lock.lock();
 #ifdef SIMPLE_THREADS
 #ifdef SIMPLE_THREADS
   while (_lock_flag) {
   while (_lock_flag) {
     thread_yield();
     thread_yield();
@@ -55,7 +55,7 @@ release() {
   assert(_lock_flag);
   assert(_lock_flag);
   _lock_flag = false;
   _lock_flag = false;
 #endif
 #endif
-  _lock.release();
+  _lock.unlock();
 }
 }
 
 
 /**
 /**

+ 8 - 8
panda/src/downloader/multiplexStreamBuf.cxx

@@ -122,9 +122,9 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
   o._owns_obj = owns_obj;
   o._owns_obj = owns_obj;
 
 
   // Ensure that we have the mutex while we fiddle with the list of outputs.
   // Ensure that we have the mutex while we fiddle with the list of outputs.
-  _lock.acquire();
+  _lock.lock();
   _outputs.push_back(o);
   _outputs.push_back(o);
-  _lock.release();
+  _lock.unlock();
 }
 }
 
 
 
 
@@ -133,9 +133,9 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
  */
  */
 void MultiplexStreamBuf::
 void MultiplexStreamBuf::
 flush() {
 flush() {
-  _lock.acquire();
+  _lock.lock();
   write_chars("", 0, true);
   write_chars("", 0, true);
-  _lock.release();
+  _lock.unlock();
 }
 }
 
 
 /**
 /**
@@ -144,7 +144,7 @@ flush() {
  */
  */
 int MultiplexStreamBuf::
 int MultiplexStreamBuf::
 overflow(int ch) {
 overflow(int ch) {
-  _lock.acquire();
+  _lock.lock();
 
 
   streamsize n = pptr() - pbase();
   streamsize n = pptr() - pbase();
 
 
@@ -159,7 +159,7 @@ overflow(int ch) {
     write_chars(&c, 1, false);
     write_chars(&c, 1, false);
   }
   }
 
 
-  _lock.release();
+  _lock.unlock();
   return 0;
   return 0;
 }
 }
 
 
@@ -169,7 +169,7 @@ overflow(int ch) {
  */
  */
 int MultiplexStreamBuf::
 int MultiplexStreamBuf::
 sync() {
 sync() {
-  _lock.acquire();
+  _lock.lock();
 
 
   streamsize n = pptr() - pbase();
   streamsize n = pptr() - pbase();
 
 
@@ -181,7 +181,7 @@ sync() {
   write_chars(pbase(), n, false);
   write_chars(pbase(), n, false);
   pbump(-n);
   pbump(-n);
 
 
-  _lock.release();
+  _lock.unlock();
   return 0;  // Return 0 for success, EOF to indicate write full.
   return 0;  // Return 0 for success, EOF to indicate write full.
 }
 }
 
 

+ 4 - 4
panda/src/downloader/virtualFileMountHTTP.cxx

@@ -238,7 +238,7 @@ output(ostream &out) const {
 PT(HTTPChannel) VirtualFileMountHTTP::
 PT(HTTPChannel) VirtualFileMountHTTP::
 get_channel() {
 get_channel() {
   PT(HTTPChannel) channel;
   PT(HTTPChannel) channel;
-  _channels_lock.acquire();
+  _channels_lock.lock();
 
 
   if (!_channels.empty()) {
   if (!_channels.empty()) {
     // If we have some channels sitting around, grab one.  Grab the one on the
     // If we have some channels sitting around, grab one.  Grab the one on the
@@ -251,7 +251,7 @@ get_channel() {
     channel = _http->make_channel(true);
     channel = _http->make_channel(true);
   }
   }
 
 
-  _channels_lock.release();
+  _channels_lock.unlock();
   return channel;
   return channel;
 }
 }
 
 
@@ -262,9 +262,9 @@ get_channel() {
  */
  */
 void VirtualFileMountHTTP::
 void VirtualFileMountHTTP::
 recycle_channel(HTTPChannel *channel) {
 recycle_channel(HTTPChannel *channel) {
-  _channels_lock.acquire();
+  _channels_lock.lock();
   _channels.push_back(channel);
   _channels.push_back(channel);
-  _channels_lock.release();
+  _channels_lock.unlock();
 }
 }
 
 
 #endif  // HAVE_OPENSSL
 #endif  // HAVE_OPENSSL

+ 2 - 2
panda/src/event/asyncFuture.cxx

@@ -273,9 +273,9 @@ wake_task(AsyncTask *task) {
     }
     }
 
 
     {
     {
-      manager->_lock.release();
+      manager->_lock.unlock();
       task->upon_birth(manager);
       task->upon_birth(manager);
-      manager->_lock.acquire();
+      manager->_lock.lock();
       nassertv(task->_manager == nullptr &&
       nassertv(task->_manager == nullptr &&
                task->_state == AsyncTask::S_inactive);
                task->_state == AsyncTask::S_inactive);
 
 

+ 2 - 2
panda/src/event/asyncTask.cxx

@@ -415,7 +415,7 @@ unlock_and_do_task() {
 #endif  // __GNUC__
 #endif  // __GNUC__
 
 
   // It's important to release the lock while the task is being serviced.
   // It's important to release the lock while the task is being serviced.
-  _manager->_lock.release();
+  _manager->_lock.unlock();
 
 
   double start = clock->get_real_time();
   double start = clock->get_real_time();
   _task_pcollector.start();
   _task_pcollector.start();
@@ -424,7 +424,7 @@ unlock_and_do_task() {
   double end = clock->get_real_time();
   double end = clock->get_real_time();
 
 
   // Now reacquire the lock (so we can return with the lock held).
   // Now reacquire the lock (so we can return with the lock held).
-  _manager->_lock.acquire();
+  _manager->_lock.lock();
 
 
   _dt = end - start;
   _dt = end - start;
   _max_dt = max(_dt, _max_dt);
   _max_dt = max(_dt, _max_dt);

+ 6 - 6
panda/src/event/asyncTaskChain.cxx

@@ -596,11 +596,11 @@ do_cleanup() {
   nassertv(_num_tasks == 0 || _num_tasks == 1);
   nassertv(_num_tasks == 0 || _num_tasks == 1);
 
 
   // Now go back and call the upon_death functions.
   // Now go back and call the upon_death functions.
-  _manager->_lock.release();
+  _manager->_lock.unlock();
   for (ti = dead.begin(); ti != dead.end(); ++ti) {
   for (ti = dead.begin(); ti != dead.end(); ++ti) {
     (*ti)->upon_death(_manager, false);
     (*ti)->upon_death(_manager, false);
   }
   }
-  _manager->_lock.acquire();
+  _manager->_lock.lock();
 
 
   if (task_cat.is_spam()) {
   if (task_cat.is_spam()) {
     do_output(task_cat.spam());
     do_output(task_cat.spam());
@@ -791,9 +791,9 @@ cleanup_task(AsyncTask *task, bool upon_death, bool clean_exit) {
   task->_manager = nullptr;
   task->_manager = nullptr;
 
 
   if (upon_death) {
   if (upon_death) {
-    _manager->_lock.release();
+    _manager->_lock.unlock();
     task->upon_death(_manager, clean_exit);
     task->upon_death(_manager, clean_exit);
-    _manager->_lock.acquire();
+    _manager->_lock.lock();
   }
   }
 }
 }
 
 
@@ -1031,7 +1031,7 @@ do_stop_threads() {
 
 
     // We have to release the lock while we join, so the threads can wake up
     // We have to release the lock while we join, so the threads can wake up
     // and see that we're shutting down.
     // and see that we're shutting down.
-    _manager->_lock.release();
+    _manager->_lock.unlock();
     Threads::iterator ti;
     Threads::iterator ti;
     for (ti = wait_threads.begin(); ti != wait_threads.end(); ++ti) {
     for (ti = wait_threads.begin(); ti != wait_threads.end(); ++ti) {
       if (task_cat.is_debug()) {
       if (task_cat.is_debug()) {
@@ -1046,7 +1046,7 @@ do_stop_threads() {
           << *Thread::get_current_thread() << "\n";
           << *Thread::get_current_thread() << "\n";
       }
       }
     }
     }
-    _manager->_lock.acquire();
+    _manager->_lock.lock();
 
 
     _state = S_initial;
     _state = S_initial;
 
 

+ 2 - 2
panda/src/event/asyncTaskManager.cxx

@@ -200,9 +200,9 @@ add(AsyncTask *task) {
              task->_state == AsyncTask::S_inactive);
              task->_state == AsyncTask::S_inactive);
     nassertv(!do_has_task(task));
     nassertv(!do_has_task(task));
 
 
-    _lock.release();
+    _lock.unlock();
     task->upon_birth(this);
     task->upon_birth(this);
-    _lock.acquire();
+    _lock.lock();
     nassertv(task->_manager == NULL &&
     nassertv(task->_manager == NULL &&
              task->_state == AsyncTask::S_inactive);
              task->_state == AsyncTask::S_inactive);
     nassertv(!do_has_task(task));
     nassertv(!do_has_task(task));

+ 2 - 2
panda/src/express/trueClock.I

@@ -21,7 +21,7 @@ get_short_time() {
   bool is_paranoid_clock = get_paranoid_clock();
   bool is_paranoid_clock = get_paranoid_clock();
 
 
   if (is_paranoid_clock) {
   if (is_paranoid_clock) {
-    _lock.acquire();
+    _lock.lock();
   }
   }
 
 
   double time = get_short_raw_time();
   double time = get_short_raw_time();
@@ -30,7 +30,7 @@ get_short_time() {
     // Check for rollforwards, rollbacks, and compensate for Speed Gear type
     // Check for rollforwards, rollbacks, and compensate for Speed Gear type
     // programs by verifying against the time of day clock.
     // programs by verifying against the time of day clock.
     time = correct_time(time);
     time = correct_time(time);
-    _lock.release();
+    _lock.unlock();
   }
   }
 
 
   return time;
   return time;

+ 48 - 48
panda/src/express/virtualFileMountRamdisk.cxx

@@ -32,9 +32,9 @@ VirtualFileMountRamdisk() : _root("") {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 has_file(const Filename &file) const {
 has_file(const Filename &file) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
-  _lock.release();
+  _lock.unlock();
   return (f != NULL);
   return (f != NULL);
 }
 }
 
 
@@ -45,9 +45,9 @@ has_file(const Filename &file) const {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 create_file(const Filename &file) {
 create_file(const Filename &file) {
-  _lock.acquire();
+  _lock.lock();
   PT(File) f = _root.do_create_file(file);
   PT(File) f = _root.do_create_file(file);
-  _lock.release();
+  _lock.unlock();
   return (f != NULL);
   return (f != NULL);
 }
 }
 
 
@@ -58,9 +58,9 @@ create_file(const Filename &file) {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 delete_file(const Filename &file) {
 delete_file(const Filename &file) {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_delete_file(file);
   PT(FileBase) f = _root.do_delete_file(file);
-  _lock.release();
+  _lock.unlock();
   return (f != NULL);
   return (f != NULL);
 }
 }
 
 
@@ -72,10 +72,10 @@ delete_file(const Filename &file) {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 rename_file(const Filename &orig_filename, const Filename &new_filename) {
 rename_file(const Filename &orig_filename, const Filename &new_filename) {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) orig_fb = _root.do_find_file(orig_filename);
   PT(FileBase) orig_fb = _root.do_find_file(orig_filename);
   if (orig_fb == NULL) {
   if (orig_fb == NULL) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -84,7 +84,7 @@ rename_file(const Filename &orig_filename, const Filename &new_filename) {
     Directory *orig_d = DCAST(Directory, orig_fb);
     Directory *orig_d = DCAST(Directory, orig_fb);
     PT(Directory) new_d = _root.do_make_directory(new_filename);
     PT(Directory) new_d = _root.do_make_directory(new_filename);
     if (new_d == NULL || !new_d->_files.empty()) {
     if (new_d == NULL || !new_d->_files.empty()) {
-      _lock.release();
+      _lock.unlock();
       return false;
       return false;
     }
     }
 
 
@@ -95,7 +95,7 @@ rename_file(const Filename &orig_filename, const Filename &new_filename) {
 
 
     new_d->_files.swap(orig_d->_files);
     new_d->_files.swap(orig_d->_files);
     _root.do_delete_file(orig_filename);
     _root.do_delete_file(orig_filename);
-    _lock.release();
+    _lock.unlock();
     return true;
     return true;
   }
   }
 
 
@@ -103,7 +103,7 @@ rename_file(const Filename &orig_filename, const Filename &new_filename) {
   File *orig_f = DCAST(File, orig_fb);
   File *orig_f = DCAST(File, orig_fb);
   PT(File) new_f = _root.do_create_file(new_filename);
   PT(File) new_f = _root.do_create_file(new_filename);
   if (new_f == NULL) {
   if (new_f == NULL) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -115,7 +115,7 @@ rename_file(const Filename &orig_filename, const Filename &new_filename) {
   new_f->_data.str(orig_f->_data.str());
   new_f->_data.str(orig_f->_data.str());
   _root.do_delete_file(orig_filename);
   _root.do_delete_file(orig_filename);
 
 
-  _lock.release();
+  _lock.unlock();
   return true;
   return true;
 }
 }
 
 
@@ -127,10 +127,10 @@ rename_file(const Filename &orig_filename, const Filename &new_filename) {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 copy_file(const Filename &orig_filename, const Filename &new_filename) {
 copy_file(const Filename &orig_filename, const Filename &new_filename) {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) orig_fb = _root.do_find_file(orig_filename);
   PT(FileBase) orig_fb = _root.do_find_file(orig_filename);
   if (orig_fb == NULL || orig_fb->is_directory()) {
   if (orig_fb == NULL || orig_fb->is_directory()) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -138,7 +138,7 @@ copy_file(const Filename &orig_filename, const Filename &new_filename) {
   File *orig_f = DCAST(File, orig_fb);
   File *orig_f = DCAST(File, orig_fb);
   PT(File) new_f = _root.do_create_file(new_filename);
   PT(File) new_f = _root.do_create_file(new_filename);
   if (new_f == NULL) {
   if (new_f == NULL) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -149,7 +149,7 @@ copy_file(const Filename &orig_filename, const Filename &new_filename) {
 
 
   new_f->_data.str(orig_f->_data.str());
   new_f->_data.str(orig_f->_data.str());
 
 
-  _lock.release();
+  _lock.unlock();
   return true;
   return true;
 }
 }
 
 
@@ -161,9 +161,9 @@ copy_file(const Filename &orig_filename, const Filename &new_filename) {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 make_directory(const Filename &file) {
 make_directory(const Filename &file) {
-  _lock.acquire();
+  _lock.lock();
   PT(Directory) f = _root.do_make_directory(file);
   PT(Directory) f = _root.do_make_directory(file);
-  _lock.release();
+  _lock.unlock();
   return (f != NULL);
   return (f != NULL);
 }
 }
 
 
@@ -173,9 +173,9 @@ make_directory(const Filename &file) {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 is_directory(const Filename &file) const {
 is_directory(const Filename &file) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
-  _lock.release();
+  _lock.unlock();
   return (f != NULL && f->is_directory());
   return (f != NULL && f->is_directory());
 }
 }
 
 
@@ -185,9 +185,9 @@ is_directory(const Filename &file) const {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 is_regular_file(const Filename &file) const {
 is_regular_file(const Filename &file) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
-  _lock.release();
+  _lock.unlock();
   return (f != NULL && !f->is_directory());
   return (f != NULL && !f->is_directory());
 }
 }
 
 
@@ -207,9 +207,9 @@ is_writable(const Filename &file) const {
  */
  */
 istream *VirtualFileMountRamdisk::
 istream *VirtualFileMountRamdisk::
 open_read_file(const Filename &file) const {
 open_read_file(const Filename &file) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
-  _lock.release();
+  _lock.unlock();
   if (f == (FileBase *)NULL || f->is_directory()) {
   if (f == (FileBase *)NULL || f->is_directory()) {
     return NULL;
     return NULL;
   }
   }
@@ -225,9 +225,9 @@ open_read_file(const Filename &file) const {
  */
  */
 ostream *VirtualFileMountRamdisk::
 ostream *VirtualFileMountRamdisk::
 open_write_file(const Filename &file, bool truncate) {
 open_write_file(const Filename &file, bool truncate) {
-  _lock.acquire();
+  _lock.lock();
   PT(File) f = _root.do_create_file(file);
   PT(File) f = _root.do_create_file(file);
-  _lock.release();
+  _lock.unlock();
   if (f == (File *)NULL) {
   if (f == (File *)NULL) {
     return NULL;
     return NULL;
   }
   }
@@ -254,9 +254,9 @@ open_write_file(const Filename &file, bool truncate) {
  */
  */
 ostream *VirtualFileMountRamdisk::
 ostream *VirtualFileMountRamdisk::
 open_append_file(const Filename &file) {
 open_append_file(const Filename &file) {
-  _lock.acquire();
+  _lock.lock();
   PT(File) f = _root.do_create_file(file);
   PT(File) f = _root.do_create_file(file);
-  _lock.release();
+  _lock.unlock();
   if (f == (File *)NULL) {
   if (f == (File *)NULL) {
     return NULL;
     return NULL;
   }
   }
@@ -271,9 +271,9 @@ open_append_file(const Filename &file) {
  */
  */
 iostream *VirtualFileMountRamdisk::
 iostream *VirtualFileMountRamdisk::
 open_read_write_file(const Filename &file, bool truncate) {
 open_read_write_file(const Filename &file, bool truncate) {
-  _lock.acquire();
+  _lock.lock();
   PT(File) f = _root.do_create_file(file);
   PT(File) f = _root.do_create_file(file);
-  _lock.release();
+  _lock.unlock();
   if (f == (File *)NULL) {
   if (f == (File *)NULL) {
     return NULL;
     return NULL;
   }
   }
@@ -296,9 +296,9 @@ open_read_write_file(const Filename &file, bool truncate) {
  */
  */
 iostream *VirtualFileMountRamdisk::
 iostream *VirtualFileMountRamdisk::
 open_read_append_file(const Filename &file) {
 open_read_append_file(const Filename &file) {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
-  _lock.release();
+  _lock.unlock();
   if (f == (FileBase *)NULL || f->is_directory()) {
   if (f == (FileBase *)NULL || f->is_directory()) {
     return NULL;
     return NULL;
   }
   }
@@ -314,9 +314,9 @@ open_read_append_file(const Filename &file) {
  */
  */
 streamsize VirtualFileMountRamdisk::
 streamsize VirtualFileMountRamdisk::
 get_file_size(const Filename &file, istream *stream) const {
 get_file_size(const Filename &file, istream *stream) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
-  _lock.release();
+  _lock.unlock();
   if (f == (FileBase *)NULL || f->is_directory()) {
   if (f == (FileBase *)NULL || f->is_directory()) {
     return 0;
     return 0;
   }
   }
@@ -331,9 +331,9 @@ get_file_size(const Filename &file, istream *stream) const {
  */
  */
 streamsize VirtualFileMountRamdisk::
 streamsize VirtualFileMountRamdisk::
 get_file_size(const Filename &file) const {
 get_file_size(const Filename &file) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
-  _lock.release();
+  _lock.unlock();
   if (f == (FileBase *)NULL || f->is_directory()) {
   if (f == (FileBase *)NULL || f->is_directory()) {
     return 0;
     return 0;
   }
   }
@@ -354,14 +354,14 @@ get_file_size(const Filename &file) const {
  */
  */
 time_t VirtualFileMountRamdisk::
 time_t VirtualFileMountRamdisk::
 get_timestamp(const Filename &file) const {
 get_timestamp(const Filename &file) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
   if (f.is_null()) {
   if (f.is_null()) {
-    _lock.release();
+    _lock.unlock();
     return 0;
     return 0;
   }
   }
   time_t timestamp = f->_timestamp;
   time_t timestamp = f->_timestamp;
-  _lock.release();
+  _lock.unlock();
   return timestamp;
   return timestamp;
 }
 }
 
 
@@ -372,17 +372,17 @@ get_timestamp(const Filename &file) const {
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 scan_directory(vector_string &contents, const Filename &dir) const {
 scan_directory(vector_string &contents, const Filename &dir) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(dir);
   PT(FileBase) f = _root.do_find_file(dir);
   if (f == (FileBase *)NULL || !f->is_directory()) {
   if (f == (FileBase *)NULL || !f->is_directory()) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
   Directory *f2 = DCAST(Directory, f);
   Directory *f2 = DCAST(Directory, f);
   bool result = f2->do_scan_directory(contents);
   bool result = f2->do_scan_directory(contents);
 
 
-  _lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 
@@ -393,10 +393,10 @@ bool VirtualFileMountRamdisk::
 atomic_compare_and_exchange_contents(const Filename &file, string &orig_contents,
 atomic_compare_and_exchange_contents(const Filename &file, string &orig_contents,
                                      const string &old_contents,
                                      const string &old_contents,
                                      const string &new_contents) {
                                      const string &new_contents) {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
   if (f == (FileBase *)NULL || f->is_directory()) {
   if (f == (FileBase *)NULL || f->is_directory()) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -409,7 +409,7 @@ atomic_compare_and_exchange_contents(const Filename &file, string &orig_contents
     retval = true;
     retval = true;
   }
   }
 
 
-  _lock.release();
+  _lock.unlock();
   return retval;
   return retval;
 }
 }
 
 
@@ -418,17 +418,17 @@ atomic_compare_and_exchange_contents(const Filename &file, string &orig_contents
  */
  */
 bool VirtualFileMountRamdisk::
 bool VirtualFileMountRamdisk::
 atomic_read_contents(const Filename &file, string &contents) const {
 atomic_read_contents(const Filename &file, string &contents) const {
-  _lock.acquire();
+  _lock.lock();
   PT(FileBase) f = _root.do_find_file(file);
   PT(FileBase) f = _root.do_find_file(file);
   if (f == (FileBase *)NULL || f->is_directory()) {
   if (f == (FileBase *)NULL || f->is_directory()) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
   File *f2 = DCAST(File, f);
   File *f2 = DCAST(File, f);
   contents = f2->_data.str();
   contents = f2->_data.str();
 
 
-  _lock.release();
+  _lock.unlock();
   return true;
   return true;
 }
 }
 
 

+ 37 - 37
panda/src/express/virtualFileSystem.cxx

@@ -190,9 +190,9 @@ mount(VirtualFileMount *mount, const Filename &mount_point, int flags) {
       << "mount " << *mount << " under " << mount_point << "\n";
       << "mount " << *mount << " under " << mount_point << "\n";
   }
   }
 
 
-  _lock.acquire();
+  _lock.lock();
   bool result = do_mount(mount, mount_point, flags);
   bool result = do_mount(mount, mount_point, flags);
-  _lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 
@@ -202,7 +202,7 @@ mount(VirtualFileMount *mount, const Filename &mount_point, int flags) {
  */
  */
 int VirtualFileSystem::
 int VirtualFileSystem::
 unmount(Multifile *multifile) {
 unmount(Multifile *multifile) {
-  _lock.acquire();
+  _lock.lock();
   Mounts::iterator ri, wi;
   Mounts::iterator ri, wi;
   wi = ri = _mounts.begin();
   wi = ri = _mounts.begin();
   while (ri != _mounts.end()) {
   while (ri != _mounts.end()) {
@@ -234,7 +234,7 @@ unmount(Multifile *multifile) {
   int num_removed = _mounts.end() - wi;
   int num_removed = _mounts.end() - wi;
   _mounts.erase(wi, _mounts.end());
   _mounts.erase(wi, _mounts.end());
   ++_mount_seq;
   ++_mount_seq;
-  _lock.release();
+  _lock.unlock();
   return num_removed;
   return num_removed;
 }
 }
 
 
@@ -244,7 +244,7 @@ unmount(Multifile *multifile) {
  */
  */
 int VirtualFileSystem::
 int VirtualFileSystem::
 unmount(const Filename &physical_filename) {
 unmount(const Filename &physical_filename) {
-  _lock.acquire();
+  _lock.lock();
   Mounts::iterator ri, wi;
   Mounts::iterator ri, wi;
   wi = ri = _mounts.begin();
   wi = ri = _mounts.begin();
   while (ri != _mounts.end()) {
   while (ri != _mounts.end()) {
@@ -293,7 +293,7 @@ unmount(const Filename &physical_filename) {
   int num_removed = _mounts.end() - wi;
   int num_removed = _mounts.end() - wi;
   _mounts.erase(wi, _mounts.end());
   _mounts.erase(wi, _mounts.end());
   ++_mount_seq;
   ++_mount_seq;
-  _lock.release();
+  _lock.unlock();
   return num_removed;
   return num_removed;
 }
 }
 
 
@@ -303,7 +303,7 @@ unmount(const Filename &physical_filename) {
  */
  */
 int VirtualFileSystem::
 int VirtualFileSystem::
 unmount(VirtualFileMount *mount) {
 unmount(VirtualFileMount *mount) {
-  _lock.acquire();
+  _lock.lock();
   Mounts::iterator ri, wi;
   Mounts::iterator ri, wi;
   wi = ri = _mounts.begin();
   wi = ri = _mounts.begin();
   while (ri != _mounts.end()) {
   while (ri != _mounts.end()) {
@@ -326,7 +326,7 @@ unmount(VirtualFileMount *mount) {
   int num_removed = _mounts.end() - wi;
   int num_removed = _mounts.end() - wi;
   _mounts.erase(wi, _mounts.end());
   _mounts.erase(wi, _mounts.end());
   ++_mount_seq;
   ++_mount_seq;
-  _lock.release();
+  _lock.unlock();
   return num_removed;
   return num_removed;
 }
 }
 
 
@@ -336,7 +336,7 @@ unmount(VirtualFileMount *mount) {
  */
  */
 int VirtualFileSystem::
 int VirtualFileSystem::
 unmount_point(const Filename &mount_point) {
 unmount_point(const Filename &mount_point) {
-  _lock.acquire();
+  _lock.lock();
   Filename nmp = normalize_mount_point(mount_point);
   Filename nmp = normalize_mount_point(mount_point);
   Mounts::iterator ri, wi;
   Mounts::iterator ri, wi;
   wi = ri = _mounts.begin();
   wi = ri = _mounts.begin();
@@ -362,7 +362,7 @@ unmount_point(const Filename &mount_point) {
   int num_removed = _mounts.end() - wi;
   int num_removed = _mounts.end() - wi;
   _mounts.erase(wi, _mounts.end());
   _mounts.erase(wi, _mounts.end());
   ++_mount_seq;
   ++_mount_seq;
-  _lock.release();
+  _lock.unlock();
   return num_removed;
   return num_removed;
 }
 }
 
 
@@ -372,7 +372,7 @@ unmount_point(const Filename &mount_point) {
  */
  */
 int VirtualFileSystem::
 int VirtualFileSystem::
 unmount_all() {
 unmount_all() {
-  _lock.acquire();
+  _lock.lock();
   Mounts::iterator ri;
   Mounts::iterator ri;
   for (ri = _mounts.begin(); ri != _mounts.end(); ++ri) {
   for (ri = _mounts.begin(); ri != _mounts.end(); ++ri) {
     VirtualFileMount *mount = (*ri);
     VirtualFileMount *mount = (*ri);
@@ -386,7 +386,7 @@ unmount_all() {
   int num_removed = _mounts.size();
   int num_removed = _mounts.size();
   _mounts.clear();
   _mounts.clear();
   ++_mount_seq;
   ++_mount_seq;
-  _lock.release();
+  _lock.unlock();
   return num_removed;
   return num_removed;
 }
 }
 
 
@@ -395,9 +395,9 @@ unmount_all() {
  */
  */
 int VirtualFileSystem::
 int VirtualFileSystem::
 get_num_mounts() const {
 get_num_mounts() const {
-  ((VirtualFileSystem *)this)->_lock.acquire();
+  _lock.lock();
   int result = _mounts.size();
   int result = _mounts.size();
-  ((VirtualFileSystem *)this)->_lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 
@@ -406,13 +406,13 @@ get_num_mounts() const {
  */
  */
 PT(VirtualFileMount) VirtualFileSystem::
 PT(VirtualFileMount) VirtualFileSystem::
 get_mount(int n) const {
 get_mount(int n) const {
-  ((VirtualFileSystem *)this)->_lock.acquire();
+  _lock.lock();
   nassertd(n >= 0 && n < (int)_mounts.size()) {
   nassertd(n >= 0 && n < (int)_mounts.size()) {
-    ((VirtualFileSystem *)this)->_lock.release();
+    _lock.unlock();
     return NULL;
     return NULL;
   }
   }
   PT(VirtualFileMount) result = _mounts[n];
   PT(VirtualFileMount) result = _mounts[n];
-  ((VirtualFileSystem *)this)->_lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 
@@ -423,21 +423,21 @@ get_mount(int n) const {
  */
  */
 bool VirtualFileSystem::
 bool VirtualFileSystem::
 chdir(const Filename &new_directory) {
 chdir(const Filename &new_directory) {
-  _lock.acquire();
+  _lock.lock();
   if (new_directory == "/") {
   if (new_directory == "/") {
     // We can always return to the root.
     // We can always return to the root.
     _cwd = new_directory;
     _cwd = new_directory;
-    _lock.release();
+    _lock.unlock();
     return true;
     return true;
   }
   }
 
 
   PT(VirtualFile) file = do_get_file(new_directory, OF_status_only);
   PT(VirtualFile) file = do_get_file(new_directory, OF_status_only);
   if (file != (VirtualFile *)NULL && file->is_directory()) {
   if (file != (VirtualFile *)NULL && file->is_directory()) {
     _cwd = file->get_filename();
     _cwd = file->get_filename();
-    _lock.release();
+    _lock.unlock();
     return true;
     return true;
   }
   }
-  _lock.release();
+  _lock.unlock();
   return false;
   return false;
 }
 }
 
 
@@ -446,9 +446,9 @@ chdir(const Filename &new_directory) {
  */
  */
 Filename VirtualFileSystem::
 Filename VirtualFileSystem::
 get_cwd() const {
 get_cwd() const {
-  ((VirtualFileSystem *)this)->_lock.acquire();
+  _lock.lock();
   Filename result = _cwd;
   Filename result = _cwd;
-  ((VirtualFileSystem *)this)->_lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 
@@ -460,9 +460,9 @@ get_cwd() const {
  */
  */
 bool VirtualFileSystem::
 bool VirtualFileSystem::
 make_directory(const Filename &filename) {
 make_directory(const Filename &filename) {
-  _lock.acquire();
+  _lock.lock();
   PT(VirtualFile) result = do_get_file(filename, OF_make_directory);
   PT(VirtualFile) result = do_get_file(filename, OF_make_directory);
-  _lock.release();
+  _lock.unlock();
   nassertr_always(result != NULL, false);
   nassertr_always(result != NULL, false);
   return result->is_directory();
   return result->is_directory();
 }
 }
@@ -474,7 +474,7 @@ make_directory(const Filename &filename) {
  */
  */
 bool VirtualFileSystem::
 bool VirtualFileSystem::
 make_directory_full(const Filename &filename) {
 make_directory_full(const Filename &filename) {
-  _lock.acquire();
+  _lock.lock();
 
 
   // First, make sure everything up to the last path is known.  We don't care
   // First, make sure everything up to the last path is known.  We don't care
   // too much if any of these fail; maybe they failed because the directory
   // too much if any of these fail; maybe they failed because the directory
@@ -489,7 +489,7 @@ make_directory_full(const Filename &filename) {
 
 
   // Now make the last one, and check the return value.
   // Now make the last one, and check the return value.
   PT(VirtualFile) result = do_get_file(filename, OF_make_directory);
   PT(VirtualFile) result = do_get_file(filename, OF_make_directory);
-  _lock.release();
+  _lock.unlock();
   nassertr_always(result != NULL, false);
   nassertr_always(result != NULL, false);
   return result->is_directory();
   return result->is_directory();
 }
 }
@@ -508,9 +508,9 @@ make_directory_full(const Filename &filename) {
 PT(VirtualFile) VirtualFileSystem::
 PT(VirtualFile) VirtualFileSystem::
 get_file(const Filename &filename, bool status_only) const {
 get_file(const Filename &filename, bool status_only) const {
   int open_flags = status_only ? OF_status_only : 0;
   int open_flags = status_only ? OF_status_only : 0;
-  ((VirtualFileSystem *)this)->_lock.acquire();
+  _lock.lock();
   PT(VirtualFile) result = do_get_file(filename, open_flags);
   PT(VirtualFile) result = do_get_file(filename, open_flags);
-  ((VirtualFileSystem *)this)->_lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 
@@ -522,9 +522,9 @@ get_file(const Filename &filename, bool status_only) const {
  */
  */
 PT(VirtualFile) VirtualFileSystem::
 PT(VirtualFile) VirtualFileSystem::
 create_file(const Filename &filename) {
 create_file(const Filename &filename) {
-  ((VirtualFileSystem *)this)->_lock.acquire();
+  _lock.lock();
   PT(VirtualFile) result = do_get_file(filename, OF_create_file);
   PT(VirtualFile) result = do_get_file(filename, OF_create_file);
-  ((VirtualFileSystem *)this)->_lock.release();
+  _lock.unlock();
   return result;
   return result;
 }
 }
 
 
@@ -588,20 +588,20 @@ delete_file(const Filename &filename) {
  */
  */
 bool VirtualFileSystem::
 bool VirtualFileSystem::
 rename_file(const Filename &orig_filename, const Filename &new_filename) {
 rename_file(const Filename &orig_filename, const Filename &new_filename) {
-  _lock.acquire();
+  _lock.lock();
   PT(VirtualFile) orig_file = do_get_file(orig_filename, OF_status_only);
   PT(VirtualFile) orig_file = do_get_file(orig_filename, OF_status_only);
   if (orig_file == (VirtualFile *)NULL) {
   if (orig_file == (VirtualFile *)NULL) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
   PT(VirtualFile) new_file = do_get_file(new_filename, OF_status_only | OF_allow_nonexist);
   PT(VirtualFile) new_file = do_get_file(new_filename, OF_status_only | OF_allow_nonexist);
   if (new_file == (VirtualFile *)NULL) {
   if (new_file == (VirtualFile *)NULL) {
-    _lock.release();
+    _lock.unlock();
     return false;
     return false;
   }
   }
 
 
-  _lock.release();
+  _lock.unlock();
 
 
   return orig_file->rename_file(new_file);
   return orig_file->rename_file(new_file);
 }
 }
@@ -712,13 +712,13 @@ find_all_files(const Filename &filename, const DSearchPath &searchpath,
  */
  */
 void VirtualFileSystem::
 void VirtualFileSystem::
 write(ostream &out) const {
 write(ostream &out) const {
-  ((VirtualFileSystem *)this)->_lock.acquire();
+  _lock.lock();
   Mounts::const_iterator mi;
   Mounts::const_iterator mi;
   for (mi = _mounts.begin(); mi != _mounts.end(); ++mi) {
   for (mi = _mounts.begin(); mi != _mounts.end(); ++mi) {
     VirtualFileMount *mount = (*mi);
     VirtualFileMount *mount = (*mi);
     mount->write(out);
     mount->write(out);
   }
   }
-  ((VirtualFileSystem *)this)->_lock.release();
+  _lock.unlock();
 }
 }
 
 
 
 

+ 1 - 1
panda/src/express/virtualFileSystem.h

@@ -157,7 +157,7 @@ private:
                       int open_flags) const;
                       int open_flags) const;
   bool consider_mount_mf(const Filename &filename);
   bool consider_mount_mf(const Filename &filename);
 
 
-  MutexImpl _lock;
+  mutable MutexImpl _lock;
   typedef pvector<PT(VirtualFileMount) > Mounts;
   typedef pvector<PT(VirtualFileMount) > Mounts;
   Mounts _mounts;
   Mounts _mounts;
   unsigned int _mount_seq;
   unsigned int _mount_seq;

+ 4 - 4
panda/src/express/weakPointerTo.I

@@ -82,11 +82,11 @@ lock() const {
   WeakReferenceList *weak_ref = this->_weak_ref;
   WeakReferenceList *weak_ref = this->_weak_ref;
   if (weak_ref != nullptr) {
   if (weak_ref != nullptr) {
     PointerTo<T> ptr;
     PointerTo<T> ptr;
-    weak_ref->_lock.acquire();
+    weak_ref->_lock.lock();
     if (!weak_ref->was_deleted()) {
     if (!weak_ref->was_deleted()) {
       ptr = (To *)WeakPointerToBase<T>::_void_ptr;
       ptr = (To *)WeakPointerToBase<T>::_void_ptr;
     }
     }
-    weak_ref->_lock.release();
+    weak_ref->_lock.unlock();
     return ptr;
     return ptr;
   }
   }
   return nullptr;
   return nullptr;
@@ -237,11 +237,11 @@ lock() const {
   WeakReferenceList *weak_ref = this->_weak_ref;
   WeakReferenceList *weak_ref = this->_weak_ref;
   if (weak_ref != nullptr) {
   if (weak_ref != nullptr) {
     ConstPointerTo<T> ptr;
     ConstPointerTo<T> ptr;
-    weak_ref->_lock.acquire();
+    weak_ref->_lock.lock();
     if (!weak_ref->was_deleted()) {
     if (!weak_ref->was_deleted()) {
       ptr = (const To *)WeakPointerToBase<T>::_void_ptr;
       ptr = (const To *)WeakPointerToBase<T>::_void_ptr;
     }
     }
-    weak_ref->_lock.release();
+    weak_ref->_lock.unlock();
     return ptr;
     return ptr;
   }
   }
   return nullptr;
   return nullptr;

+ 6 - 6
panda/src/express/weakReferenceList.cxx

@@ -41,7 +41,7 @@ WeakReferenceList::
 void WeakReferenceList::
 void WeakReferenceList::
 add_callback(WeakPointerCallback *callback, void *data) {
 add_callback(WeakPointerCallback *callback, void *data) {
   nassertv(callback != nullptr);
   nassertv(callback != nullptr);
-  _lock.acquire();
+  _lock.lock();
   // We need to check again whether the object is deleted after grabbing the
   // We need to check again whether the object is deleted after grabbing the
   // lock, despite having already done this in weakPointerTo.I, since it may
   // lock, despite having already done this in weakPointerTo.I, since it may
   // have been deleted in the meantime.
   // have been deleted in the meantime.
@@ -49,7 +49,7 @@ add_callback(WeakPointerCallback *callback, void *data) {
   if (!deleted) {
   if (!deleted) {
     _callbacks.insert(make_pair(callback, data));
     _callbacks.insert(make_pair(callback, data));
   }
   }
-  _lock.release();
+  _lock.unlock();
 
 
   if (deleted) {
   if (deleted) {
     callback->wp_callback(data);
     callback->wp_callback(data);
@@ -65,9 +65,9 @@ add_callback(WeakPointerCallback *callback, void *data) {
 void WeakReferenceList::
 void WeakReferenceList::
 remove_callback(WeakPointerCallback *callback) {
 remove_callback(WeakPointerCallback *callback) {
   nassertv(callback != nullptr);
   nassertv(callback != nullptr);
-  _lock.acquire();
+  _lock.lock();
   _callbacks.erase(callback);
   _callbacks.erase(callback);
-  _lock.release();
+  _lock.unlock();
 }
 }
 
 
 /**
 /**
@@ -76,7 +76,7 @@ remove_callback(WeakPointerCallback *callback) {
  */
  */
 void WeakReferenceList::
 void WeakReferenceList::
 mark_deleted() {
 mark_deleted() {
-  _lock.acquire();
+  _lock.lock();
   Callbacks::iterator ci;
   Callbacks::iterator ci;
   for (ci = _callbacks.begin(); ci != _callbacks.end(); ++ci) {
   for (ci = _callbacks.begin(); ci != _callbacks.end(); ++ci) {
     (*ci).first->wp_callback((*ci).second);
     (*ci).first->wp_callback((*ci).second);
@@ -86,7 +86,7 @@ mark_deleted() {
   // Decrement the special offset added to the weak pointer count to indicate
   // Decrement the special offset added to the weak pointer count to indicate
   // that it can be deleted when all the weak references have gone.
   // that it can be deleted when all the weak references have gone.
   AtomicAdjust::Integer result = AtomicAdjust::add(_count, -_alive_offset);
   AtomicAdjust::Integer result = AtomicAdjust::add(_count, -_alive_offset);
-  _lock.release();
+  _lock.unlock();
   if (result == 0) {
   if (result == 0) {
     // There are no weak references remaining either, so delete this.
     // There are no weak references remaining either, so delete this.
     delete this;
     delete this;

+ 2 - 2
panda/src/gobj/adaptiveLru.cxx

@@ -360,9 +360,9 @@ do_evict_to(size_t target_size, bool hard_evict) {
 
 
         } else {
         } else {
           // We must release the lock while we call evict_lru().
           // We must release the lock while we call evict_lru().
-          _lock.release();
+          _lock.unlock();
           page->evict_lru();
           page->evict_lru();
-          _lock.acquire();
+          _lock.lock();
 
 
           if (_total_size <= target_size) {
           if (_total_size <= target_size) {
             // We've evicted enough to satisfy our target.
             // We've evicted enough to satisfy our target.

+ 2 - 2
panda/src/gobj/simpleLru.cxx

@@ -169,9 +169,9 @@ do_evict_to(size_t target_size, bool hard_evict) {
     SimpleLruPage *next = (SimpleLruPage *)node->_next;
     SimpleLruPage *next = (SimpleLruPage *)node->_next;
 
 
     // We must release the lock while we call evict_lru().
     // We must release the lock while we call evict_lru().
-    _global_lock.release();
+    _global_lock.unlock();
     node->evict_lru();
     node->evict_lru();
-    _global_lock.acquire();
+    _global_lock.lock();
 
 
     if (node == end || node == _prev) {
     if (node == end || node == _prev) {
       // If we reach the original tail of the list, stop.
       // If we reach the original tail of the list, stop.

+ 2 - 2
panda/src/gobj/texture.cxx

@@ -5239,14 +5239,14 @@ unlocked_ensure_ram_image(bool allow_compression) {
 
 
   PT(Texture) tex = do_make_copy(cdata);
   PT(Texture) tex = do_make_copy(cdata);
   _cycler.release_read(cdata);
   _cycler.release_read(cdata);
-  _lock.release();
+  _lock.unlock();
 
 
   // Perform the actual reload in a copy of the texture, while our own mutex
   // Perform the actual reload in a copy of the texture, while our own mutex
   // is left unlocked.
   // is left unlocked.
   CDWriter cdata_tex(tex->_cycler, true);
   CDWriter cdata_tex(tex->_cycler, true);
   tex->do_reload_ram_image(cdata_tex, allow_compression);
   tex->do_reload_ram_image(cdata_tex, allow_compression);
 
 
-  _lock.acquire();
+  _lock.lock();
 
 
   CData *cdataw = _cycler.write_upstream(false, current_thread);
   CData *cdataw = _cycler.write_upstream(false, current_thread);
 
 

+ 13 - 13
panda/src/pipeline/conditionVarDebug.cxx

@@ -57,7 +57,7 @@ ConditionVarDebug::
  */
  */
 void ConditionVarDebug::
 void ConditionVarDebug::
 wait() {
 wait() {
-  _mutex._global_lock->acquire();
+  _mutex._global_lock->lock();
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
@@ -66,7 +66,7 @@ wait() {
     ostr << *current_thread << " attempted to wait on "
     ostr << *current_thread << " attempted to wait on "
          << *this << " without holding " << _mutex;
          << *this << " without holding " << _mutex;
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _mutex._global_lock->release();
+    _mutex._global_lock->unlock();
     return;
     return;
   }
   }
 
 
@@ -80,9 +80,9 @@ wait() {
   }
   }
   current_thread->_waiting_on_cvar = this;
   current_thread->_waiting_on_cvar = this;
 
 
-  _mutex.do_release();
+  _mutex.do_unlock();
   _impl.wait();  // temporarily releases _global_lock
   _impl.wait();  // temporarily releases _global_lock
-  _mutex.do_acquire(current_thread);
+  _mutex.do_lock(current_thread);
 
 
   nassertd(current_thread->_waiting_on_cvar == this) {
   nassertd(current_thread->_waiting_on_cvar == this) {
   }
   }
@@ -93,7 +93,7 @@ wait() {
       << *current_thread << " awake on " << *this << "\n";
       << *current_thread << " awake on " << *this << "\n";
   }
   }
 
 
-  _mutex._global_lock->release();
+  _mutex._global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -106,7 +106,7 @@ wait() {
  */
  */
 void ConditionVarDebug::
 void ConditionVarDebug::
 wait(double timeout) {
 wait(double timeout) {
-  _mutex._global_lock->acquire();
+  _mutex._global_lock->lock();
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
@@ -115,7 +115,7 @@ wait(double timeout) {
     ostr << *current_thread << " attempted to wait on "
     ostr << *current_thread << " attempted to wait on "
          << *this << " without holding " << _mutex;
          << *this << " without holding " << _mutex;
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _mutex._global_lock->release();
+    _mutex._global_lock->unlock();
     return;
     return;
   }
   }
 
 
@@ -130,9 +130,9 @@ wait(double timeout) {
   }
   }
   current_thread->_waiting_on_cvar = this;
   current_thread->_waiting_on_cvar = this;
 
 
-  _mutex.do_release();
+  _mutex.do_unlock();
   _impl.wait(timeout);  // temporarily releases _global_lock
   _impl.wait(timeout);  // temporarily releases _global_lock
-  _mutex.do_acquire(current_thread);
+  _mutex.do_lock(current_thread);
 
 
   nassertd(current_thread->_waiting_on_cvar == this) {
   nassertd(current_thread->_waiting_on_cvar == this) {
   }
   }
@@ -143,7 +143,7 @@ wait(double timeout) {
       << *current_thread << " awake on " << *this << "\n";
       << *current_thread << " awake on " << *this << "\n";
   }
   }
 
 
-  _mutex._global_lock->release();
+  _mutex._global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -160,7 +160,7 @@ wait(double timeout) {
  */
  */
 void ConditionVarDebug::
 void ConditionVarDebug::
 notify() {
 notify() {
-  _mutex._global_lock->acquire();
+  _mutex._global_lock->lock();
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
@@ -169,7 +169,7 @@ notify() {
     ostr << *current_thread << " attempted to notify "
     ostr << *current_thread << " attempted to notify "
          << *this << " without holding " << _mutex;
          << *this << " without holding " << _mutex;
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _mutex._global_lock->release();
+    _mutex._global_lock->unlock();
     return;
     return;
   }
   }
 
 
@@ -179,7 +179,7 @@ notify() {
   }
   }
 
 
   _impl.notify();
   _impl.notify();
-  _mutex._global_lock->release();
+  _mutex._global_lock->unlock();
 }
 }
 
 
 /**
 /**

+ 16 - 16
panda/src/pipeline/conditionVarFullDebug.cxx

@@ -57,7 +57,7 @@ ConditionVarFullDebug::
  */
  */
 void ConditionVarFullDebug::
 void ConditionVarFullDebug::
 wait() {
 wait() {
-  _mutex._global_lock->acquire();
+  _mutex._global_lock->lock();
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
@@ -66,7 +66,7 @@ wait() {
     ostr << *current_thread << " attempted to wait on "
     ostr << *current_thread << " attempted to wait on "
          << *this << " without holding " << _mutex;
          << *this << " without holding " << _mutex;
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _mutex._global_lock->release();
+    _mutex._global_lock->unlock();
     return;
     return;
   }
   }
 
 
@@ -80,9 +80,9 @@ wait() {
   }
   }
   current_thread->_waiting_on_cvar_full = this;
   current_thread->_waiting_on_cvar_full = this;
 
 
-  _mutex.do_release();
+  _mutex.do_unlock();
   _impl.wait();  // temporarily releases _global_lock
   _impl.wait();  // temporarily releases _global_lock
-  _mutex.do_acquire(current_thread);
+  _mutex.do_lock(current_thread);
 
 
   nassertd(current_thread->_waiting_on_cvar_full == this) {
   nassertd(current_thread->_waiting_on_cvar_full == this) {
   }
   }
@@ -93,7 +93,7 @@ wait() {
       << *current_thread << " awake on " << *this << "\n";
       << *current_thread << " awake on " << *this << "\n";
   }
   }
 
 
-  _mutex._global_lock->release();
+  _mutex._global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -106,7 +106,7 @@ wait() {
  */
  */
 void ConditionVarFullDebug::
 void ConditionVarFullDebug::
 wait(double timeout) {
 wait(double timeout) {
-  _mutex._global_lock->acquire();
+  _mutex._global_lock->lock();
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
@@ -115,7 +115,7 @@ wait(double timeout) {
     ostr << *current_thread << " attempted to wait on "
     ostr << *current_thread << " attempted to wait on "
          << *this << " without holding " << _mutex;
          << *this << " without holding " << _mutex;
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _mutex._global_lock->release();
+    _mutex._global_lock->unlock();
     return;
     return;
   }
   }
 
 
@@ -130,9 +130,9 @@ wait(double timeout) {
   }
   }
   current_thread->_waiting_on_cvar_full = this;
   current_thread->_waiting_on_cvar_full = this;
 
 
-  _mutex.do_release();
+  _mutex.do_unlock();
   _impl.wait(timeout);  // temporarily releases _global_lock
   _impl.wait(timeout);  // temporarily releases _global_lock
-  _mutex.do_acquire(current_thread);
+  _mutex.do_lock(current_thread);
 
 
   nassertd(current_thread->_waiting_on_cvar_full == this) {
   nassertd(current_thread->_waiting_on_cvar_full == this) {
   }
   }
@@ -143,7 +143,7 @@ wait(double timeout) {
       << *current_thread << " awake on " << *this << "\n";
       << *current_thread << " awake on " << *this << "\n";
   }
   }
 
 
-  _mutex._global_lock->release();
+  _mutex._global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -160,7 +160,7 @@ wait(double timeout) {
  */
  */
 void ConditionVarFullDebug::
 void ConditionVarFullDebug::
 notify() {
 notify() {
-  _mutex._global_lock->acquire();
+  _mutex._global_lock->lock();
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
@@ -169,7 +169,7 @@ notify() {
     ostr << *current_thread << " attempted to notify "
     ostr << *current_thread << " attempted to notify "
          << *this << " without holding " << _mutex;
          << *this << " without holding " << _mutex;
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _mutex._global_lock->release();
+    _mutex._global_lock->unlock();
     return;
     return;
   }
   }
 
 
@@ -179,7 +179,7 @@ notify() {
   }
   }
 
 
   _impl.notify();
   _impl.notify();
-  _mutex._global_lock->release();
+  _mutex._global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -193,7 +193,7 @@ notify() {
  */
  */
 void ConditionVarFullDebug::
 void ConditionVarFullDebug::
 notify_all() {
 notify_all() {
-  _mutex._global_lock->acquire();
+  _mutex._global_lock->lock();
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
@@ -202,7 +202,7 @@ notify_all() {
     ostr << *current_thread << " attempted to notify "
     ostr << *current_thread << " attempted to notify "
          << *this << " without holding " << _mutex;
          << *this << " without holding " << _mutex;
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _mutex._global_lock->release();
+    _mutex._global_lock->unlock();
     return;
     return;
   }
   }
 
 
@@ -212,7 +212,7 @@ notify_all() {
   }
   }
 
 
   _impl.notify_all();
   _impl.notify_all();
-  _mutex._global_lock->release();
+  _mutex._global_lock->unlock();
 }
 }
 
 
 /**
 /**

+ 4 - 4
panda/src/pipeline/conditionVarSimpleImpl.cxx

@@ -23,14 +23,14 @@
  */
  */
 void ConditionVarSimpleImpl::
 void ConditionVarSimpleImpl::
 wait() {
 wait() {
-  _mutex.release_quietly();
+  _mutex.unlock_quietly();
 
 
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
   ThreadSimpleImpl *thread = manager->get_current_thread();
   ThreadSimpleImpl *thread = manager->get_current_thread();
   manager->enqueue_block(thread, this);
   manager->enqueue_block(thread, this);
   manager->next_context();
   manager->next_context();
 
 
-  _mutex.acquire();
+  _mutex.lock();
 }
 }
 
 
 /**
 /**
@@ -38,7 +38,7 @@ wait() {
  */
  */
 void ConditionVarSimpleImpl::
 void ConditionVarSimpleImpl::
 wait(double timeout) {
 wait(double timeout) {
-  _mutex.release_quietly();
+  _mutex.unlock_quietly();
 
 
   // TODO.  For now this will release every frame, since we don't have an
   // TODO.  For now this will release every frame, since we don't have an
   // interface yet on ThreadSimpleManager to do a timed wait.  Maybe that's
   // interface yet on ThreadSimpleManager to do a timed wait.  Maybe that's
@@ -49,7 +49,7 @@ wait(double timeout) {
   manager->enqueue_ready(thread, true);
   manager->enqueue_ready(thread, true);
   manager->next_context();
   manager->next_context();
 
 
-  _mutex.acquire();
+  _mutex.lock();
 }
 }
 
 
 /**
 /**

+ 32 - 2
panda/src/pipeline/lightMutexDirect.I

@@ -41,6 +41,36 @@ operator = (const LightMutexDirect &copy) {
   nassertv(false);
   nassertv(false);
 }
 }
 
 
+/**
+ * Alias for acquire() to match C++11 semantics.
+ * @see acquire()
+ */
+INLINE void LightMutexDirect::
+lock() {
+  TAU_PROFILE("void LightMutexDirect::acquire()", " ", TAU_USER);
+  _impl.lock();
+}
+
+/**
+ * Alias for try_acquire() to match C++11 semantics.
+ * @see try_acquire()
+ */
+INLINE bool LightMutexDirect::
+try_lock() {
+  TAU_PROFILE("void LightMutexDirect::try_acquire()", " ", TAU_USER);
+  return _impl.try_lock();
+}
+
+/**
+ * Alias for release() to match C++11 semantics.
+ * @see release()
+ */
+INLINE void LightMutexDirect::
+unlock() {
+  TAU_PROFILE("void LightMutexDirect::unlock()", " ", TAU_USER);
+  _impl.unlock();
+}
+
 /**
 /**
  * Grabs the lightMutex if it is available.  If it is not available, blocks
  * Grabs the lightMutex if it is available.  If it is not available, blocks
  * until it becomes available, then grabs it.  In either case, the function
  * until it becomes available, then grabs it.  In either case, the function
@@ -55,7 +85,7 @@ operator = (const LightMutexDirect &copy) {
 INLINE void LightMutexDirect::
 INLINE void LightMutexDirect::
 acquire() const {
 acquire() const {
   TAU_PROFILE("void LightMutexDirect::acquire()", " ", TAU_USER);
   TAU_PROFILE("void LightMutexDirect::acquire()", " ", TAU_USER);
-  ((LightMutexDirect *)this)->_impl.acquire();
+  _impl.lock();
 }
 }
 
 
 /**
 /**
@@ -68,7 +98,7 @@ acquire() const {
 INLINE void LightMutexDirect::
 INLINE void LightMutexDirect::
 release() const {
 release() const {
   TAU_PROFILE("void LightMutexDirect::release()", " ", TAU_USER);
   TAU_PROFILE("void LightMutexDirect::release()", " ", TAU_USER);
-  ((LightMutexDirect *)this)->_impl.release();
+  _impl.unlock();
 }
 }
 
 
 /**
 /**

+ 7 - 2
panda/src/pipeline/lightMutexDirect.h

@@ -36,6 +36,11 @@ private:
   INLINE LightMutexDirect(const LightMutexDirect &copy);
   INLINE LightMutexDirect(const LightMutexDirect &copy);
   INLINE void operator = (const LightMutexDirect &copy);
   INLINE void operator = (const LightMutexDirect &copy);
 
 
+public:
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
+
 PUBLISHED:
 PUBLISHED:
   BLOCKING INLINE void acquire() const;
   BLOCKING INLINE void acquire() const;
   INLINE void release() const;
   INLINE void release() const;
@@ -54,9 +59,9 @@ private:
   // even in the SIMPLE_THREADS case.  We have to do this since any PStatTimer
   // even in the SIMPLE_THREADS case.  We have to do this since any PStatTimer
   // call may trigger a context switch, and any low-level context switch
   // call may trigger a context switch, and any low-level context switch
   // requires all containing mutexes to be true mutexes.
   // requires all containing mutexes to be true mutexes.
-  MutexTrueImpl _impl;
+  mutable MutexTrueImpl _impl;
 #else
 #else
-  MutexImpl _impl;
+  mutable MutexImpl _impl;
 #endif  // DO_PSTATS
 #endif  // DO_PSTATS
 };
 };
 
 

+ 46 - 8
panda/src/pipeline/lightReMutexDirect.I

@@ -53,6 +53,36 @@ operator = (const LightReMutexDirect &copy) {
   nassertv(false);
   nassertv(false);
 }
 }
 
 
+/**
+ * Alias for acquire() to match C++11 semantics.
+ * @see acquire()
+ */
+INLINE void LightReMutexDirect::
+lock() {
+  TAU_PROFILE("void LightReMutexDirect::acquire()", " ", TAU_USER);
+  _impl.lock();
+}
+
+/**
+ * Alias for try_acquire() to match C++11 semantics.
+ * @see try_acquire()
+ */
+INLINE bool LightReMutexDirect::
+try_lock() {
+  TAU_PROFILE("void LightReMutexDirect::try_acquire()", " ", TAU_USER);
+  return _impl.try_lock();
+}
+
+/**
+ * Alias for release() to match C++11 semantics.
+ * @see release()
+ */
+INLINE void LightReMutexDirect::
+unlock() {
+  TAU_PROFILE("void LightReMutexDirect::unlock()", " ", TAU_USER);
+  _impl.unlock();
+}
+
 /**
 /**
  * Grabs the lightReMutex if it is available.  If it is not available, blocks
  * Grabs the lightReMutex if it is available.  If it is not available, blocks
  * until it becomes available, then grabs it.  In either case, the function
  * until it becomes available, then grabs it.  In either case, the function
@@ -67,7 +97,11 @@ operator = (const LightReMutexDirect &copy) {
 INLINE void LightReMutexDirect::
 INLINE void LightReMutexDirect::
 acquire() const {
 acquire() const {
   TAU_PROFILE("void LightReMutexDirect::acquire()", " ", TAU_USER);
   TAU_PROFILE("void LightReMutexDirect::acquire()", " ", TAU_USER);
-  ((LightReMutexDirect *)this)->_impl.acquire();
+#ifdef HAVE_REMUTEXTRUEIMPL
+  _impl.lock();
+#else
+  _impl.do_lock(Thread::get_current_thread());
+#endif
 }
 }
 
 
 /**
 /**
@@ -77,10 +111,10 @@ acquire() const {
 INLINE void LightReMutexDirect::
 INLINE void LightReMutexDirect::
 acquire(Thread *current_thread) const {
 acquire(Thread *current_thread) const {
   TAU_PROFILE("void LightReMutexDirect::acquire(Thread *)", " ", TAU_USER);
   TAU_PROFILE("void LightReMutexDirect::acquire(Thread *)", " ", TAU_USER);
-#ifdef HAVE_REMUTEXIMPL
-  ((LightReMutexDirect *)this)->_impl.acquire();
+#ifdef HAVE_REMUTEXTRUEIMPL
+  _impl.lock();
 #else
 #else
-  ((LightReMutexDirect *)this)->_impl.do_lock(current_thread);
+  _impl.do_lock(current_thread);
 #endif  // HAVE_REMUTEXIMPL
 #endif  // HAVE_REMUTEXIMPL
 }
 }
 
 
@@ -97,10 +131,10 @@ acquire(Thread *current_thread) const {
 INLINE void LightReMutexDirect::
 INLINE void LightReMutexDirect::
 elevate_lock() const {
 elevate_lock() const {
   TAU_PROFILE("void LightReMutexDirect::elevate_lock()", " ", TAU_USER);
   TAU_PROFILE("void LightReMutexDirect::elevate_lock()", " ", TAU_USER);
-#ifdef HAVE_REMUTEXIMPL
-  ((LightReMutexDirect *)this)->_impl.acquire();
+#ifdef HAVE_REMUTEXTRUEIMPL
+  _impl.lock();
 #else
 #else
-  ((LightReMutexDirect *)this)->_impl.do_elevate_lock();
+  _impl.do_elevate_lock();
 #endif  // HAVE_REMUTEXIMPL
 #endif  // HAVE_REMUTEXIMPL
 }
 }
 
 
@@ -114,7 +148,11 @@ elevate_lock() const {
 INLINE void LightReMutexDirect::
 INLINE void LightReMutexDirect::
 release() const {
 release() const {
   TAU_PROFILE("void LightReMutexDirect::release()", " ", TAU_USER);
   TAU_PROFILE("void LightReMutexDirect::release()", " ", TAU_USER);
-  ((LightReMutexDirect *)this)->_impl.release();
+#ifdef HAVE_REMUTEXTRUEIMPL
+  _impl.unlock();
+#else
+  _impl.do_unlock(Thread::get_current_thread());
+#endif
 }
 }
 
 
 /**
 /**

+ 8 - 3
panda/src/pipeline/lightReMutexDirect.h

@@ -35,6 +35,11 @@ private:
   INLINE LightReMutexDirect(const LightReMutexDirect &copy);
   INLINE LightReMutexDirect(const LightReMutexDirect &copy);
   INLINE void operator = (const LightReMutexDirect &copy);
   INLINE void operator = (const LightReMutexDirect &copy);
 
 
+public:
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
+
 PUBLISHED:
 PUBLISHED:
   BLOCKING INLINE void acquire() const;
   BLOCKING INLINE void acquire() const;
   BLOCKING INLINE void acquire(Thread *current_thread) const;
   BLOCKING INLINE void acquire(Thread *current_thread) const;
@@ -51,13 +56,13 @@ PUBLISHED:
   void output(ostream &out) const;
   void output(ostream &out) const;
 
 
 private:
 private:
-#if defined(HAVE_REMUTEXIMPL) && !defined(DO_PSTATS)
-  ReMutexImpl _impl;
+#ifdef HAVE_REMUTEXTRUEIMPL
+  mutable ReMutexImpl _impl;
 
 
 #else
 #else
   // If we don't have a reentrant mutex, use the one we hand-rolled in
   // If we don't have a reentrant mutex, use the one we hand-rolled in
   // ReMutexDirect.
   // ReMutexDirect.
-  ReMutexDirect _impl;
+  mutable ReMutexDirect _impl;
 #endif  // HAVE_REMUTEXIMPL
 #endif  // HAVE_REMUTEXIMPL
 };
 };
 
 

+ 49 - 12
panda/src/pipeline/mutexDebug.I

@@ -27,6 +27,43 @@ operator = (const MutexDebug &copy) {
   nassertv(false);
   nassertv(false);
 }
 }
 
 
+/**
+ * Alias for acquire() to match C++11 semantics.
+ * @see acquire()
+ */
+INLINE void MutexDebug::
+lock() {
+  TAU_PROFILE("void MutexDebug::acquire()", " ", TAU_USER);
+  _global_lock->lock();
+  ((MutexDebug *)this)->do_lock(Thread::get_current_thread());
+  _global_lock->unlock();
+}
+
+/**
+ * Alias for try_acquire() to match C++11 semantics.
+ * @see try_acquire()
+ */
+INLINE bool MutexDebug::
+try_lock() {
+  TAU_PROFILE("void MutexDebug::try_lock()", " ", TAU_USER);
+  _global_lock->lock();
+  bool acquired = ((MutexDebug *)this)->do_try_lock(Thread::get_current_thread());
+  _global_lock->unlock();
+  return acquired;
+}
+
+/**
+ * Alias for release() to match C++11 semantics.
+ * @see release()
+ */
+INLINE void MutexDebug::
+unlock() {
+  TAU_PROFILE("void MutexDebug::unlock()", " ", TAU_USER);
+  _global_lock->lock();
+  ((MutexDebug *)this)->do_unlock();
+  _global_lock->unlock();
+}
+
 /**
 /**
  * Grabs the mutex if it is available.  If it is not available, blocks until
  * Grabs the mutex if it is available.  If it is not available, blocks until
  * it becomes available, then grabs it.  In either case, the function does not
  * it becomes available, then grabs it.  In either case, the function does not
@@ -41,9 +78,9 @@ INLINE void MutexDebug::
 acquire(Thread *current_thread) const {
 acquire(Thread *current_thread) const {
   TAU_PROFILE("void MutexDebug::acquire(Thread *)", " ", TAU_USER);
   TAU_PROFILE("void MutexDebug::acquire(Thread *)", " ", TAU_USER);
   nassertv(current_thread == Thread::get_current_thread());
   nassertv(current_thread == Thread::get_current_thread());
-  _global_lock->acquire();
-  ((MutexDebug *)this)->do_acquire(current_thread);
-  _global_lock->release();
+  _global_lock->lock();
+  ((MutexDebug *)this)->do_lock(current_thread);
+  _global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -52,11 +89,11 @@ acquire(Thread *current_thread) const {
  */
  */
 INLINE bool MutexDebug::
 INLINE bool MutexDebug::
 try_acquire(Thread *current_thread) const {
 try_acquire(Thread *current_thread) const {
-  TAU_PROFILE("void MutexDebug::acquire(Thread *)", " ", TAU_USER);
+  TAU_PROFILE("void MutexDebug::try_acquire(Thread *)", " ", TAU_USER);
   nassertr(current_thread == Thread::get_current_thread(), false);
   nassertr(current_thread == Thread::get_current_thread(), false);
-  _global_lock->acquire();
-  bool acquired = ((MutexDebug *)this)->do_try_acquire(current_thread);
-  _global_lock->release();
+  _global_lock->lock();
+  bool acquired = ((MutexDebug *)this)->do_try_lock(current_thread);
+  _global_lock->unlock();
   return acquired;
   return acquired;
 }
 }
 
 
@@ -93,9 +130,9 @@ elevate_lock() const {
 INLINE void MutexDebug::
 INLINE void MutexDebug::
 release() const {
 release() const {
   TAU_PROFILE("void MutexDebug::release()", " ", TAU_USER);
   TAU_PROFILE("void MutexDebug::release()", " ", TAU_USER);
-  _global_lock->acquire();
-  ((MutexDebug *)this)->do_release();
-  _global_lock->release();
+  _global_lock->lock();
+  ((MutexDebug *)this)->do_unlock();
+  _global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -107,9 +144,9 @@ release() const {
 INLINE bool MutexDebug::
 INLINE bool MutexDebug::
 debug_is_locked() const {
 debug_is_locked() const {
   TAU_PROFILE("bool MutexDebug::debug_is_locked()", " ", TAU_USER);
   TAU_PROFILE("bool MutexDebug::debug_is_locked()", " ", TAU_USER);
-  _global_lock->acquire();
+  _global_lock->lock();
   bool is_locked = do_debug_is_locked();
   bool is_locked = do_debug_is_locked();
-  _global_lock->release();
+  _global_lock->unlock();
   return is_locked;
   return is_locked;
 }
 }
 
 

+ 9 - 9
panda/src/pipeline/mutexDebug.cxx

@@ -84,12 +84,12 @@ output(ostream &out) const {
  */
  */
 void MutexDebug::
 void MutexDebug::
 output_with_holder(ostream &out) const {
 output_with_holder(ostream &out) const {
-  _global_lock->acquire();
+  _global_lock->lock();
   output(out);
   output(out);
   if (_locking_thread != (Thread *)NULL) {
   if (_locking_thread != (Thread *)NULL) {
     out << " (held by " << *_locking_thread << ")\n";
     out << " (held by " << *_locking_thread << ")\n";
   }
   }
-  _global_lock->release();
+  _global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -99,9 +99,9 @@ output_with_holder(ostream &out) const {
  */
  */
 void MutexDebug::
 void MutexDebug::
 increment_pstats() {
 increment_pstats() {
-  _global_lock->acquire();
+  _global_lock->lock();
   ++_pstats_count;
   ++_pstats_count;
-  _global_lock->release();
+  _global_lock->unlock();
 }
 }
 
 
 /**
 /**
@@ -110,16 +110,16 @@ increment_pstats() {
  */
  */
 void MutexDebug::
 void MutexDebug::
 decrement_pstats() {
 decrement_pstats() {
-  _global_lock->acquire();
+  _global_lock->lock();
   --_pstats_count;
   --_pstats_count;
-  _global_lock->release();
+  _global_lock->unlock();
 }
 }
 
 
 /**
 /**
  * The private implementation of acquire() assumes that _lock_impl is held.
  * The private implementation of acquire() assumes that _lock_impl is held.
  */
  */
 void MutexDebug::
 void MutexDebug::
-do_acquire(Thread *current_thread) {
+do_lock(Thread *current_thread) {
   // If this assertion is triggered, you tried to lock a recently-destructed
   // If this assertion is triggered, you tried to lock a recently-destructed
   // mutex.
   // mutex.
   nassertd(_lock_count != -100) {
   nassertd(_lock_count != -100) {
@@ -235,7 +235,7 @@ do_acquire(Thread *current_thread) {
  * held.
  * held.
  */
  */
 bool MutexDebug::
 bool MutexDebug::
-do_try_acquire(Thread *current_thread) {
+do_try_lock(Thread *current_thread) {
   // If this assertion is triggered, you tried to lock a recently-destructed
   // If this assertion is triggered, you tried to lock a recently-destructed
   // mutex.
   // mutex.
   nassertd(_lock_count != -100) {
   nassertd(_lock_count != -100) {
@@ -301,7 +301,7 @@ do_try_acquire(Thread *current_thread) {
  * The private implementation of acquire() assumes that _lock_impl is held.
  * The private implementation of acquire() assumes that _lock_impl is held.
  */
  */
 void MutexDebug::
 void MutexDebug::
-do_release() {
+do_unlock() {
   // If this assertion is triggered, you tried to release a recently-
   // If this assertion is triggered, you tried to release a recently-
   // destructed mutex.
   // destructed mutex.
   nassertd(_lock_count != -100) {
   nassertd(_lock_count != -100) {

+ 8 - 3
panda/src/pipeline/mutexDebug.h

@@ -35,6 +35,11 @@ private:
   INLINE MutexDebug(const MutexDebug &copy);
   INLINE MutexDebug(const MutexDebug &copy);
   INLINE void operator = (const MutexDebug &copy);
   INLINE void operator = (const MutexDebug &copy);
 
 
+public:
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
+
 PUBLISHED:
 PUBLISHED:
   BLOCKING INLINE void acquire(Thread *current_thread = Thread::get_current_thread()) const;
   BLOCKING INLINE void acquire(Thread *current_thread = Thread::get_current_thread()) const;
   BLOCKING INLINE bool try_acquire(Thread *current_thread = Thread::get_current_thread()) const;
   BLOCKING INLINE bool try_acquire(Thread *current_thread = Thread::get_current_thread()) const;
@@ -52,9 +57,9 @@ public:
   static void decrement_pstats();
   static void decrement_pstats();
 
 
 private:
 private:
-  void do_acquire(Thread *current_thread);
-  bool do_try_acquire(Thread *current_thread);
-  void do_release();
+  void do_lock(Thread *current_thread);
+  bool do_try_lock(Thread *current_thread);
+  void do_unlock();
   bool do_debug_is_locked() const;
   bool do_debug_is_locked() const;
 
 
   void report_deadlock(Thread *current_thread);
   void report_deadlock(Thread *current_thread);

+ 33 - 3
panda/src/pipeline/mutexDirect.I

@@ -41,6 +41,36 @@ operator = (const MutexDirect &copy) {
   nassertv(false);
   nassertv(false);
 }
 }
 
 
+/**
+ * Alias for acquire() to match C++11 semantics.
+ * @see acquire()
+ */
+INLINE void MutexDirect::
+lock() {
+  TAU_PROFILE("void MutexDirect::acquire()", " ", TAU_USER);
+  _impl.lock();
+}
+
+/**
+ * Alias for try_acquire() to match C++11 semantics.
+ * @see try_acquire()
+ */
+INLINE bool MutexDirect::
+try_lock() {
+  TAU_PROFILE("void MutexDirect::try_acquire()", " ", TAU_USER);
+  return _impl.try_lock();
+}
+
+/**
+ * Alias for release() to match C++11 semantics.
+ * @see release()
+ */
+INLINE void MutexDirect::
+unlock() {
+  TAU_PROFILE("void MutexDirect::unlock()", " ", TAU_USER);
+  _impl.unlock();
+}
+
 /**
 /**
  * Grabs the mutex if it is available.  If it is not available, blocks until
  * Grabs the mutex if it is available.  If it is not available, blocks until
  * it becomes available, then grabs it.  In either case, the function does not
  * it becomes available, then grabs it.  In either case, the function does not
@@ -54,7 +84,7 @@ operator = (const MutexDirect &copy) {
 INLINE void MutexDirect::
 INLINE void MutexDirect::
 acquire() const {
 acquire() const {
   TAU_PROFILE("void MutexDirect::acquire()", " ", TAU_USER);
   TAU_PROFILE("void MutexDirect::acquire()", " ", TAU_USER);
-  ((MutexDirect *)this)->_impl.acquire();
+  _impl.lock();
 }
 }
 
 
 /**
 /**
@@ -64,7 +94,7 @@ acquire() const {
 INLINE bool MutexDirect::
 INLINE bool MutexDirect::
 try_acquire() const {
 try_acquire() const {
   TAU_PROFILE("void MutexDirect::acquire(bool)", " ", TAU_USER);
   TAU_PROFILE("void MutexDirect::acquire(bool)", " ", TAU_USER);
-  return ((MutexDirect *)this)->_impl.try_acquire();
+  return _impl.try_lock();
 }
 }
 
 
 /**
 /**
@@ -77,7 +107,7 @@ try_acquire() const {
 INLINE void MutexDirect::
 INLINE void MutexDirect::
 release() const {
 release() const {
   TAU_PROFILE("void MutexDirect::release()", " ", TAU_USER);
   TAU_PROFILE("void MutexDirect::release()", " ", TAU_USER);
-  ((MutexDirect *)this)->_impl.release();
+  _impl.unlock();
 }
 }
 
 
 /**
 /**

+ 6 - 1
panda/src/pipeline/mutexDirect.h

@@ -35,6 +35,11 @@ private:
   INLINE MutexDirect(const MutexDirect &copy);
   INLINE MutexDirect(const MutexDirect &copy);
   INLINE void operator = (const MutexDirect &copy);
   INLINE void operator = (const MutexDirect &copy);
 
 
+public:
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
+
 PUBLISHED:
 PUBLISHED:
   BLOCKING INLINE void acquire() const;
   BLOCKING INLINE void acquire() const;
   BLOCKING INLINE bool try_acquire() const;
   BLOCKING INLINE bool try_acquire() const;
@@ -49,7 +54,7 @@ PUBLISHED:
   void output(ostream &out) const;
   void output(ostream &out) const;
 
 
 private:
 private:
-  MutexTrueImpl _impl;
+  mutable MutexTrueImpl _impl;
 
 
   friend class ConditionVarDirect;
   friend class ConditionVarDirect;
   friend class ConditionVarFullDirect;
   friend class ConditionVarFullDirect;

+ 8 - 22
panda/src/pipeline/mutexSimpleImpl.I

@@ -11,27 +11,13 @@
  * @date 2007-06-19
  * @date 2007-06-19
  */
  */
 
 
-/**
- *
- */
-INLINE MutexSimpleImpl::
-MutexSimpleImpl() {
-}
-
-/**
- *
- */
-INLINE MutexSimpleImpl::
-~MutexSimpleImpl() {
-}
-
 /**
 /**
  *
  *
  */
  */
 INLINE void MutexSimpleImpl::
 INLINE void MutexSimpleImpl::
-acquire() {
-  if (!try_acquire()) {
-    do_acquire();
+lock() {
+  if (!try_lock()) {
+    do_lock();
   }
   }
 }
 }
 
 
@@ -39,7 +25,7 @@ acquire() {
  *
  *
  */
  */
 INLINE bool MutexSimpleImpl::
 INLINE bool MutexSimpleImpl::
-try_acquire() {
+try_lock() {
   if ((_flags & F_lock_count) != 0) {
   if ((_flags & F_lock_count) != 0) {
     return false;
     return false;
   }
   }
@@ -52,12 +38,12 @@ try_acquire() {
  * waiters on the mutex.
  * waiters on the mutex.
  */
  */
 INLINE void MutexSimpleImpl::
 INLINE void MutexSimpleImpl::
-release() {
+unlock() {
   nassertv((_flags & F_lock_count) != 0);
   nassertv((_flags & F_lock_count) != 0);
   _flags &= ~F_lock_count;
   _flags &= ~F_lock_count;
 
 
   if (_flags & F_has_waiters) {
   if (_flags & F_has_waiters) {
-    do_release();
+    do_unlock();
   }
   }
 }
 }
 
 
@@ -65,11 +51,11 @@ release() {
  * Releases the mutex, without allowing a context switch to occur.
  * Releases the mutex, without allowing a context switch to occur.
  */
  */
 INLINE void MutexSimpleImpl::
 INLINE void MutexSimpleImpl::
-release_quietly() {
+unlock_quietly() {
   nassertv((_flags & F_lock_count) != 0);
   nassertv((_flags & F_lock_count) != 0);
   _flags &= ~F_lock_count;
   _flags &= ~F_lock_count;
 
 
   if (_flags & F_has_waiters) {
   if (_flags & F_has_waiters) {
-    do_release_quietly();
+    do_unlock_quietly();
   }
   }
 }
 }

+ 3 - 3
panda/src/pipeline/mutexSimpleImpl.cxx

@@ -23,7 +23,7 @@
  *
  *
  */
  */
 void MutexSimpleImpl::
 void MutexSimpleImpl::
-do_acquire() {
+do_lock() {
   // By the time we get here, we already know that someone else is holding the
   // By the time we get here, we already know that someone else is holding the
   // lock: (_flags & F_lock_count) != 0.
   // lock: (_flags & F_lock_count) != 0.
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
@@ -41,7 +41,7 @@ do_acquire() {
  *
  *
  */
  */
 void MutexSimpleImpl::
 void MutexSimpleImpl::
-do_release() {
+do_unlock() {
   // By the time we get here, we already know that someone else is blocked on
   // By the time we get here, we already know that someone else is blocked on
   // this mutex: (_flags & F_waiters) != 0.
   // this mutex: (_flags & F_waiters) != 0.
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
@@ -58,7 +58,7 @@ do_release() {
  *
  *
  */
  */
 void MutexSimpleImpl::
 void MutexSimpleImpl::
-do_release_quietly() {
+do_unlock_quietly() {
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
   ThreadSimpleManager *manager = ThreadSimpleManager::get_global_ptr();
   manager->unblock_one(this);
   manager->unblock_one(this);
 }
 }

+ 8 - 9
panda/src/pipeline/mutexSimpleImpl.h

@@ -36,18 +36,17 @@
  */
  */
 class EXPCL_PANDA_PIPELINE MutexSimpleImpl : public BlockerSimple {
 class EXPCL_PANDA_PIPELINE MutexSimpleImpl : public BlockerSimple {
 public:
 public:
-  INLINE MutexSimpleImpl();
-  INLINE ~MutexSimpleImpl();
+  CONSTEXPR MutexSimpleImpl() DEFAULT_CTOR;
 
 
-  INLINE void acquire();
-  INLINE bool try_acquire();
-  INLINE void release();
-  INLINE void release_quietly();
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
+  INLINE void unlock_quietly();
 
 
 private:
 private:
-  void do_acquire();
-  void do_release();
-  void do_release_quietly();
+  void do_lock();
+  void do_unlock();
+  void do_unlock_quietly();
 
 
   friend class ThreadSimpleManager;
   friend class ThreadSimpleManager;
 };
 };

+ 19 - 19
panda/src/pipeline/pipeline.cxx

@@ -134,7 +134,7 @@ cycle() {
         while (link != &prev_dirty) {
         while (link != &prev_dirty) {
           PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)link;
           PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)link;
 
 
-          if (!cycler->_lock.try_acquire()) {
+          if (!cycler->_lock.try_lock()) {
             // No big deal, just move on to the next one for now, and we'll
             // No big deal, just move on to the next one for now, and we'll
             // come back around to it.  It's important not to block here in
             // come back around to it.  It's important not to block here in
             // order to prevent one cycler from deadlocking another.
             // order to prevent one cycler from deadlocking another.
@@ -144,7 +144,7 @@ cycle() {
             } else {
             } else {
               // Well, we are the last cycler left, so we might as well wait.
               // Well, we are the last cycler left, so we might as well wait.
               // This is necessary to trigger the deadlock detection code.
               // This is necessary to trigger the deadlock detection code.
-              cycler->_lock.acquire();
+              cycler->_lock.lock();
             }
             }
           }
           }
 
 
@@ -162,7 +162,7 @@ cycle() {
 #ifdef DEBUG_THREADS
 #ifdef DEBUG_THREADS
           inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
           inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
 #endif
 #endif
-          cycler->_lock.release();
+          cycler->_lock.unlock();
           break;
           break;
         }
         }
       }
       }
@@ -174,7 +174,7 @@ cycle() {
         while (link != &prev_dirty) {
         while (link != &prev_dirty) {
           PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)link;
           PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)link;
 
 
-          if (!cycler->_lock.try_acquire()) {
+          if (!cycler->_lock.try_lock()) {
             // No big deal, just move on to the next one for now, and we'll
             // No big deal, just move on to the next one for now, and we'll
             // come back around to it.  It's important not to block here in
             // come back around to it.  It's important not to block here in
             // order to prevent one cycler from deadlocking another.
             // order to prevent one cycler from deadlocking another.
@@ -184,7 +184,7 @@ cycle() {
             } else {
             } else {
               // Well, we are the last cycler left, so we might as well wait.
               // Well, we are the last cycler left, so we might as well wait.
               // This is necessary to trigger the deadlock detection code.
               // This is necessary to trigger the deadlock detection code.
-              cycler->_lock.acquire();
+              cycler->_lock.lock();
             }
             }
           }
           }
 
 
@@ -206,7 +206,7 @@ cycle() {
             inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
             inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
 #endif
 #endif
           }
           }
-          cycler->_lock.release();
+          cycler->_lock.unlock();
           break;
           break;
         }
         }
       }
       }
@@ -218,7 +218,7 @@ cycle() {
         while (link != &prev_dirty) {
         while (link != &prev_dirty) {
           PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)link;
           PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)link;
 
 
-          if (!cycler->_lock.try_acquire()) {
+          if (!cycler->_lock.try_lock()) {
             // No big deal, just move on to the next one for now, and we'll
             // No big deal, just move on to the next one for now, and we'll
             // come back around to it.  It's important not to block here in
             // come back around to it.  It's important not to block here in
             // order to prevent one cycler from deadlocking another.
             // order to prevent one cycler from deadlocking another.
@@ -228,7 +228,7 @@ cycle() {
             } else {
             } else {
               // Well, we are the last cycler left, so we might as well wait.
               // Well, we are the last cycler left, so we might as well wait.
               // This is necessary to trigger the deadlock detection code.
               // This is necessary to trigger the deadlock detection code.
-              cycler->_lock.acquire();
+              cycler->_lock.lock();
             }
             }
           }
           }
 
 
@@ -250,7 +250,7 @@ cycle() {
             inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
             inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
 #endif
 #endif
           }
           }
-          cycler->_lock.release();
+          cycler->_lock.unlock();
           break;
           break;
         }
         }
       }
       }
@@ -293,11 +293,11 @@ set_num_stages(int num_stages) {
     PipelineCyclerLinks *links;
     PipelineCyclerLinks *links;
     for (links = _clean._next; links != &_clean; links = links->_next) {
     for (links = _clean._next; links != &_clean; links = links->_next) {
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
-      cycler->_lock.acquire();
+      cycler->_lock.lock();
     }
     }
     for (links = _dirty._next; links != &_dirty; links = links->_next) {
     for (links = _dirty._next; links != &_dirty; links = links->_next) {
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
-      cycler->_lock.acquire();
+      cycler->_lock.lock();
     }
     }
 
 
     _num_stages = num_stages;
     _num_stages = num_stages;
@@ -315,12 +315,12 @@ set_num_stages(int num_stages) {
     int count = 0;
     int count = 0;
     for (links = _clean._next; links != &_clean; links = links->_next) {
     for (links = _clean._next; links != &_clean; links = links->_next) {
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
-      cycler->_lock.release();
+      cycler->_lock.unlock();
       ++count;
       ++count;
     }
     }
     for (links = _dirty._next; links != &_dirty; links = links->_next) {
     for (links = _dirty._next; links != &_dirty; links = links->_next) {
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
       PipelineCyclerTrueImpl *cycler = (PipelineCyclerTrueImpl *)links;
-      cycler->_lock.release();
+      cycler->_lock.unlock();
       ++count;
       ++count;
     }
     }
     nassertv(count == _num_cyclers);
     nassertv(count == _num_cyclers);
@@ -402,7 +402,7 @@ remove_cycler(PipelineCyclerTrueImpl *cycler) {
   // during cycle only if it's 0 (clean) or _next_cycle_seq (scheduled for the
   // during cycle only if it's 0 (clean) or _next_cycle_seq (scheduled for the
   // next cycle, so not owned by the current one).
   // next cycle, so not owned by the current one).
   while (cycler->_dirty != 0 && cycler->_dirty != _next_cycle_seq) {
   while (cycler->_dirty != 0 && cycler->_dirty != _next_cycle_seq) {
-    if (_cycle_lock.try_acquire()) {
+    if (_cycle_lock.try_lock()) {
       // OK, great, we got the lock, so it finished cycling already.
       // OK, great, we got the lock, so it finished cycling already.
       nassertv(!_cycling);
       nassertv(!_cycling);
 
 
@@ -417,16 +417,16 @@ remove_cycler(PipelineCyclerTrueImpl *cycler) {
       inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
       inc_cycler_type(_dirty_cycler_types, cycler->get_parent_type(), -1);
   #endif
   #endif
 
 
-      _cycle_lock.release();
+      _cycle_lock.unlock();
       return;
       return;
     } else {
     } else {
       // It's possibly currently being cycled.  We will wait for the cycler
       // It's possibly currently being cycled.  We will wait for the cycler
       // to be done with it, so that we can safely remove it.
       // to be done with it, so that we can safely remove it.
-      _lock.release();
-      cycler->_lock.release();
+      _lock.unlock();
+      cycler->_lock.unlock();
       Thread::force_yield();
       Thread::force_yield();
-      cycler->_lock.acquire();
-      _lock.acquire();
+      cycler->_lock.lock();
+      _lock.lock();
     }
     }
   }
   }
 
 

+ 45 - 15
panda/src/pipeline/reMutexDirect.I

@@ -53,6 +53,36 @@ operator = (const ReMutexDirect &copy) {
   nassertv(false);
   nassertv(false);
 }
 }
 
 
+/**
+ * Alias for acquire() to match C++11 semantics.
+ * @see acquire()
+ */
+INLINE void ReMutexDirect::
+lock() {
+  TAU_PROFILE("void ReMutexDirect::acquire()", " ", TAU_USER);
+  _impl.lock();
+}
+
+/**
+ * Alias for try_acquire() to match C++11 semantics.
+ * @see try_acquire()
+ */
+INLINE bool ReMutexDirect::
+try_lock() {
+  TAU_PROFILE("void ReMutexDirect::try_acquire()", " ", TAU_USER);
+  return _impl.try_lock();
+}
+
+/**
+ * Alias for release() to match C++11 semantics.
+ * @see release()
+ */
+INLINE void ReMutexDirect::
+unlock() {
+  TAU_PROFILE("void ReMutexDirect::unlock()", " ", TAU_USER);
+  _impl.unlock();
+}
+
 /**
 /**
  * Grabs the reMutex if it is available.  If it is not available, blocks until
  * Grabs the reMutex if it is available.  If it is not available, blocks until
  * it becomes available, then grabs it.  In either case, the function does not
  * it becomes available, then grabs it.  In either case, the function does not
@@ -67,9 +97,9 @@ INLINE void ReMutexDirect::
 acquire() const {
 acquire() const {
   TAU_PROFILE("void ReMutexDirect::acquire()", " ", TAU_USER);
   TAU_PROFILE("void ReMutexDirect::acquire()", " ", TAU_USER);
 #ifdef HAVE_REMUTEXTRUEIMPL
 #ifdef HAVE_REMUTEXTRUEIMPL
-  ((ReMutexDirect *)this)->_impl.acquire();
+  _impl.lock();
 #else
 #else
-  ((ReMutexDirect *)this)->do_acquire();
+  ((ReMutexDirect *)this)->do_lock();
 #endif  // HAVE_REMUTEXTRUEIMPL
 #endif  // HAVE_REMUTEXTRUEIMPL
 }
 }
 
 
@@ -81,9 +111,9 @@ INLINE void ReMutexDirect::
 acquire(Thread *current_thread) const {
 acquire(Thread *current_thread) const {
   TAU_PROFILE("void ReMutexDirect::acquire(Thread *)", " ", TAU_USER);
   TAU_PROFILE("void ReMutexDirect::acquire(Thread *)", " ", TAU_USER);
 #ifdef HAVE_REMUTEXTRUEIMPL
 #ifdef HAVE_REMUTEXTRUEIMPL
-  ((ReMutexDirect *)this)->_impl.acquire();
+  _impl.lock();
 #else
 #else
-  ((ReMutexDirect *)this)->do_acquire(current_thread);
+  ((ReMutexDirect *)this)->do_lock(current_thread);
 #endif  // HAVE_REMUTEXTRUEIMPL
 #endif  // HAVE_REMUTEXTRUEIMPL
 }
 }
 
 
@@ -95,9 +125,9 @@ INLINE bool ReMutexDirect::
 try_acquire() const {
 try_acquire() const {
   TAU_PROFILE("void ReMutexDirect::acquire(bool)", " ", TAU_USER);
   TAU_PROFILE("void ReMutexDirect::acquire(bool)", " ", TAU_USER);
 #ifdef HAVE_REMUTEXTRUEIMPL
 #ifdef HAVE_REMUTEXTRUEIMPL
-  return ((ReMutexDirect *)this)->_impl.try_acquire();
+  return _impl.try_lock();
 #else
 #else
-  return ((ReMutexDirect *)this)->do_try_acquire();
+  return ((ReMutexDirect *)this)->do_try_lock();
 #endif  // HAVE_REMUTEXTRUEIMPL
 #endif  // HAVE_REMUTEXTRUEIMPL
 }
 }
 
 
@@ -109,9 +139,9 @@ INLINE bool ReMutexDirect::
 try_acquire(Thread *current_thread) const {
 try_acquire(Thread *current_thread) const {
   TAU_PROFILE("void ReMutexDirect::acquire(bool)", " ", TAU_USER);
   TAU_PROFILE("void ReMutexDirect::acquire(bool)", " ", TAU_USER);
 #ifdef HAVE_REMUTEXTRUEIMPL
 #ifdef HAVE_REMUTEXTRUEIMPL
-  return ((ReMutexDirect *)this)->_impl.try_acquire();
+  return _impl.try_lock();
 #else
 #else
-  return ((ReMutexDirect *)this)->do_try_acquire(current_thread);
+  return ((ReMutexDirect *)this)->do_try_lock(current_thread);
 #endif  // HAVE_REMUTEXTRUEIMPL
 #endif  // HAVE_REMUTEXTRUEIMPL
 }
 }
 
 
@@ -129,7 +159,7 @@ INLINE void ReMutexDirect::
 elevate_lock() const {
 elevate_lock() const {
   TAU_PROFILE("void ReMutexDirect::elevate_lock()", " ", TAU_USER);
   TAU_PROFILE("void ReMutexDirect::elevate_lock()", " ", TAU_USER);
 #ifdef HAVE_REMUTEXTRUEIMPL
 #ifdef HAVE_REMUTEXTRUEIMPL
-  ((ReMutexDirect *)this)->_impl.acquire();
+  _impl.lock();
 #else
 #else
   ((ReMutexDirect *)this)->do_elevate_lock();
   ((ReMutexDirect *)this)->do_elevate_lock();
 #endif  // HAVE_REMUTEXTRUEIMPL
 #endif  // HAVE_REMUTEXTRUEIMPL
@@ -146,9 +176,9 @@ INLINE void ReMutexDirect::
 release() const {
 release() const {
   TAU_PROFILE("void ReMutexDirect::release()", " ", TAU_USER);
   TAU_PROFILE("void ReMutexDirect::release()", " ", TAU_USER);
 #ifdef HAVE_REMUTEXTRUEIMPL
 #ifdef HAVE_REMUTEXTRUEIMPL
-  ((ReMutexDirect *)this)->_impl.release();
+  _impl.unlock();
 #else
 #else
-  ((ReMutexDirect *)this)->do_release();
+  ((ReMutexDirect *)this)->do_unlock();
 #endif  // HAVE_REMUTEXTRUEIMPL
 #endif  // HAVE_REMUTEXTRUEIMPL
 }
 }
 
 
@@ -201,8 +231,8 @@ get_name() const {
  * mutex).
  * mutex).
  */
  */
 INLINE void ReMutexDirect::
 INLINE void ReMutexDirect::
-do_acquire() {
-  do_acquire(Thread::get_current_thread());
+do_lock() {
+  do_lock(Thread::get_current_thread());
 }
 }
 #endif
 #endif
 
 
@@ -214,7 +244,7 @@ do_acquire() {
  * mutex).
  * mutex).
  */
  */
 INLINE bool ReMutexDirect::
 INLINE bool ReMutexDirect::
-do_try_acquire() {
-  return do_try_acquire(Thread::get_current_thread());
+do_try_lock() {
+  return do_try_lock(Thread::get_current_thread());
 }
 }
 #endif
 #endif

+ 14 - 14
panda/src/pipeline/reMutexDirect.cxx

@@ -33,8 +33,8 @@ output(ostream &out) const {
  * mutex).
  * mutex).
  */
  */
 void ReMutexDirect::
 void ReMutexDirect::
-do_acquire(Thread *current_thread) {
-  _lock_impl.acquire();
+do_lock(Thread *current_thread) {
+  _lock_impl.lock();
 
 
   if (_locking_thread == (Thread *)NULL) {
   if (_locking_thread == (Thread *)NULL) {
     // The mutex is not already locked by anyone.  Lock it.
     // The mutex is not already locked by anyone.  Lock it.
@@ -61,7 +61,7 @@ do_acquire(Thread *current_thread) {
     nassertd(_lock_count == 1) {
     nassertd(_lock_count == 1) {
     }
     }
   }
   }
-  _lock_impl.release();
+  _lock_impl.unlock();
 }
 }
 #endif  // !HAVE_REMUTEXTRUEIMPL
 #endif  // !HAVE_REMUTEXTRUEIMPL
 
 
@@ -73,9 +73,9 @@ do_acquire(Thread *current_thread) {
  * mutex).
  * mutex).
  */
  */
 bool ReMutexDirect::
 bool ReMutexDirect::
-do_try_acquire(Thread *current_thread) {
+do_try_lock(Thread *current_thread) {
   bool acquired = true;
   bool acquired = true;
-  _lock_impl.acquire();
+  _lock_impl.lock();
 
 
   if (_locking_thread == (Thread *)NULL) {
   if (_locking_thread == (Thread *)NULL) {
     // The mutex is not already locked by anyone.  Lock it.
     // The mutex is not already locked by anyone.  Lock it.
@@ -94,7 +94,7 @@ do_try_acquire(Thread *current_thread) {
     // The mutex is locked by some other thread.  Return false.
     // The mutex is locked by some other thread.  Return false.
     acquired = false;
     acquired = false;
   }
   }
-  _lock_impl.release();
+  _lock_impl.unlock();
 
 
   return acquired;
   return acquired;
 }
 }
@@ -109,16 +109,16 @@ do_try_acquire(Thread *current_thread) {
  */
  */
 void ReMutexDirect::
 void ReMutexDirect::
 do_elevate_lock() {
 do_elevate_lock() {
-  _lock_impl.acquire();
+  _lock_impl.lock();
 
 
 #ifdef _DEBUG
 #ifdef _DEBUG
   nassertd(_locking_thread == Thread::get_current_thread()) {
   nassertd(_locking_thread == Thread::get_current_thread()) {
-    _lock_impl.release();
+    _lock_impl.unlock();
     return;
     return;
   }
   }
 #elif !defined(NDEBUG)
 #elif !defined(NDEBUG)
   nassertd(_locking_thread != (Thread *)NULL) {
   nassertd(_locking_thread != (Thread *)NULL) {
-    _lock_impl.release();
+    _lock_impl.unlock();
     return;
     return;
   }
   }
 #endif  // NDEBUG
 #endif  // NDEBUG
@@ -129,7 +129,7 @@ do_elevate_lock() {
   nassertd(_lock_count > 0) {
   nassertd(_lock_count > 0) {
   }
   }
 
 
-  _lock_impl.release();
+  _lock_impl.unlock();
 }
 }
 #endif  // !HAVE_REMUTEXTRUEIMPL
 #endif  // !HAVE_REMUTEXTRUEIMPL
 
 
@@ -141,8 +141,8 @@ do_elevate_lock() {
  * mutex).
  * mutex).
  */
  */
 void ReMutexDirect::
 void ReMutexDirect::
-do_release() {
-  _lock_impl.acquire();
+do_unlock() {
+  _lock_impl.lock();
 
 
 #ifdef _DEBUG
 #ifdef _DEBUG
   if (_locking_thread != Thread::get_current_thread()) {
   if (_locking_thread != Thread::get_current_thread()) {
@@ -150,7 +150,7 @@ do_release() {
     ostr << *_locking_thread << " attempted to release "
     ostr << *_locking_thread << " attempted to release "
          << *this << " which it does not own";
          << *this << " which it does not own";
     nassert_raise(ostr.str());
     nassert_raise(ostr.str());
-    _lock_impl.release();
+    _lock_impl.unlock();
     return;
     return;
   }
   }
 #endif  // _DEBUG
 #endif  // _DEBUG
@@ -164,7 +164,7 @@ do_release() {
     _locking_thread = (Thread *)NULL;
     _locking_thread = (Thread *)NULL;
     _cvar_impl.notify();
     _cvar_impl.notify();
   }
   }
-  _lock_impl.release();
+  _lock_impl.unlock();
 }
 }
 #endif  // !HAVE_REMUTEXTRUEIMPL
 #endif  // !HAVE_REMUTEXTRUEIMPL
 
 

+ 11 - 6
panda/src/pipeline/reMutexDirect.h

@@ -35,6 +35,11 @@ private:
   INLINE ReMutexDirect(const ReMutexDirect &copy);
   INLINE ReMutexDirect(const ReMutexDirect &copy);
   INLINE void operator = (const ReMutexDirect &copy);
   INLINE void operator = (const ReMutexDirect &copy);
 
 
+public:
+  INLINE void lock();
+  INLINE bool try_lock();
+  INLINE void unlock();
+
 PUBLISHED:
 PUBLISHED:
   BLOCKING INLINE void acquire() const;
   BLOCKING INLINE void acquire() const;
   BLOCKING INLINE void acquire(Thread *current_thread) const;
   BLOCKING INLINE void acquire(Thread *current_thread) const;
@@ -54,16 +59,16 @@ PUBLISHED:
 
 
 private:
 private:
 #ifdef HAVE_REMUTEXTRUEIMPL
 #ifdef HAVE_REMUTEXTRUEIMPL
-  ReMutexImpl _impl;
+  mutable ReMutexImpl _impl;
 
 
 #else
 #else
   // If we don't have a reentrant mutex, we have to hand-roll one.
   // If we don't have a reentrant mutex, we have to hand-roll one.
-  INLINE void do_acquire();
-  void do_acquire(Thread *current_thread);
-  INLINE bool do_try_acquire();
-  bool do_try_acquire(Thread *current_thread);
+  INLINE void do_lock();
+  void do_lock(Thread *current_thread);
+  INLINE bool do_try_lock();
+  bool do_try_lock(Thread *current_thread);
   void do_elevate_lock();
   void do_elevate_lock();
-  void do_release();
+  void do_unlock();
 
 
   Thread *_locking_thread;
   Thread *_locking_thread;
   int _lock_count;
   int _lock_count;

+ 4 - 4
panda/src/pipeline/test_mutex.cxx

@@ -33,9 +33,9 @@ public:
     double start = clock->get_short_time();
     double start = clock->get_short_time();
     double end = start + thread_duration;
     double end = start + thread_duration;
     while (clock->get_short_time() < end) {
     while (clock->get_short_time() < end) {
-      _m1.acquire();
+      _m1.lock();
       Thread::sleep(_period);
       Thread::sleep(_period);
-      _m1.release();
+      _m1.unlock();
     }
     }
   }
   }
 
 
@@ -47,8 +47,8 @@ int
 main(int argc, char *argv[]) {
 main(int argc, char *argv[]) {
   MutexImpl _m1;
   MutexImpl _m1;
 
 
-  _m1.acquire();
-  _m1.release();
+  _m1.lock();
+  _m1.unlock();
 
 
   cerr << "Making threads.\n";
   cerr << "Making threads.\n";
   MyThread *a = new MyThread("a", _m1, 1.0);
   MyThread *a = new MyThread("a", _m1, 1.0);

+ 15 - 15
panda/src/pipeline/threadPosixImpl.cxx

@@ -41,14 +41,14 @@ ThreadPosixImpl::
       << "Deleting thread " << _parent_obj->get_name() << "\n";
       << "Deleting thread " << _parent_obj->get_name() << "\n";
   }
   }
 
 
-  _mutex.acquire();
+  _mutex.lock();
 
 
   if (!_detached) {
   if (!_detached) {
     pthread_detach(_thread);
     pthread_detach(_thread);
     _detached = true;
     _detached = true;
   }
   }
 
 
-  _mutex.release();
+  _mutex.unlock();
 }
 }
 
 
 /**
 /**
@@ -65,13 +65,13 @@ setup_main_thread() {
  */
  */
 bool ThreadPosixImpl::
 bool ThreadPosixImpl::
 start(ThreadPriority priority, bool joinable) {
 start(ThreadPriority priority, bool joinable) {
-  _mutex.acquire();
+  _mutex.lock();
   if (thread_cat->is_debug()) {
   if (thread_cat->is_debug()) {
     thread_cat.debug() << "Starting " << *_parent_obj << "\n";
     thread_cat.debug() << "Starting " << *_parent_obj << "\n";
   }
   }
 
 
   nassertd(_status == S_new) {
   nassertd(_status == S_new) {
-    _mutex.release();
+    _mutex.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -148,12 +148,12 @@ start(ThreadPriority priority, bool joinable) {
     // Oops, we couldn't start the thread.  Be sure to decrement the reference
     // Oops, we couldn't start the thread.  Be sure to decrement the reference
     // count we incremented above, and return false to indicate failure.
     // count we incremented above, and return false to indicate failure.
     unref_delete(_parent_obj);
     unref_delete(_parent_obj);
-    _mutex.release();
+    _mutex.unlock();
     return false;
     return false;
   }
   }
 
 
   // Thread was successfully started.
   // Thread was successfully started.
-  _mutex.release();
+  _mutex.unlock();
   return true;
   return true;
 }
 }
 
 
@@ -163,15 +163,15 @@ start(ThreadPriority priority, bool joinable) {
  */
  */
 void ThreadPosixImpl::
 void ThreadPosixImpl::
 join() {
 join() {
-  _mutex.acquire();
+  _mutex.lock();
   if (!_detached) {
   if (!_detached) {
-    _mutex.release();
+    _mutex.unlock();
     void *return_val;
     void *return_val;
     pthread_join(_thread, &return_val);
     pthread_join(_thread, &return_val);
     _detached = true;
     _detached = true;
     return;
     return;
   }
   }
-  _mutex.release();
+  _mutex.unlock();
 }
 }
 
 
 /**
 /**
@@ -246,14 +246,14 @@ root_func(void *data) {
     nassertr(result == 0, NULL);
     nassertr(result == 0, NULL);
 
 
     {
     {
-      self->_mutex.acquire();
+      self->_mutex.lock();
       nassertd(self->_status == S_start_called) {
       nassertd(self->_status == S_start_called) {
-        self->_mutex.release();
+        self->_mutex.unlock();
         return NULL;
         return NULL;
       }
       }
 
 
       self->_status = S_running;
       self->_status = S_running;
-      self->_mutex.release();
+      self->_mutex.unlock();
     }
     }
 
 
 #ifdef ANDROID
 #ifdef ANDROID
@@ -270,13 +270,13 @@ root_func(void *data) {
     }
     }
 
 
     {
     {
-      self->_mutex.acquire();
+      self->_mutex.lock();
       nassertd(self->_status == S_running) {
       nassertd(self->_status == S_running) {
-        self->_mutex.release();
+        self->_mutex.unlock();
         return NULL;
         return NULL;
       }
       }
       self->_status = S_finished;
       self->_status = S_finished;
-      self->_mutex.release();
+      self->_mutex.unlock();
     }
     }
 
 
 #ifdef ANDROID
 #ifdef ANDROID

+ 13 - 13
panda/src/pipeline/threadWin32Impl.cxx

@@ -49,13 +49,13 @@ setup_main_thread() {
  */
  */
 bool ThreadWin32Impl::
 bool ThreadWin32Impl::
 start(ThreadPriority priority, bool joinable) {
 start(ThreadPriority priority, bool joinable) {
-  _mutex.acquire();
+  _mutex.lock();
   if (thread_cat->is_debug()) {
   if (thread_cat->is_debug()) {
     thread_cat.debug() << "Starting " << *_parent_obj << "\n";
     thread_cat.debug() << "Starting " << *_parent_obj << "\n";
   }
   }
 
 
   nassertd(_status == S_new && _thread == 0) {
   nassertd(_status == S_new && _thread == 0) {
-    _mutex.release();
+    _mutex.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -76,7 +76,7 @@ start(ThreadPriority priority, bool joinable) {
     // Oops, we couldn't start the thread.  Be sure to decrement the reference
     // Oops, we couldn't start the thread.  Be sure to decrement the reference
     // count we incremented above, and return false to indicate failure.
     // count we incremented above, and return false to indicate failure.
     unref_delete(_parent_obj);
     unref_delete(_parent_obj);
-    _mutex.release();
+    _mutex.unlock();
     return false;
     return false;
   }
   }
 
 
@@ -100,7 +100,7 @@ start(ThreadPriority priority, bool joinable) {
     break;
     break;
   }
   }
 
 
-  _mutex.release();
+  _mutex.unlock();
   return true;
   return true;
 }
 }
 
 
@@ -110,16 +110,16 @@ start(ThreadPriority priority, bool joinable) {
  */
  */
 void ThreadWin32Impl::
 void ThreadWin32Impl::
 join() {
 join() {
-  _mutex.acquire();
+  _mutex.lock();
   nassertd(_joinable && _status != S_new) {
   nassertd(_joinable && _status != S_new) {
-    _mutex.release();
+    _mutex.unlock();
     return;
     return;
   }
   }
 
 
   while (_status != S_finished) {
   while (_status != S_finished) {
     _cv.wait();
     _cv.wait();
   }
   }
-  _mutex.release();
+  _mutex.unlock();
 }
 }
 
 
 /**
 /**
@@ -147,14 +147,14 @@ root_func(LPVOID data) {
     nassertr(result, 1);
     nassertr(result, 1);
 
 
     {
     {
-      self->_mutex.acquire();
+      self->_mutex.lock();
       nassertd(self->_status == S_start_called) {
       nassertd(self->_status == S_start_called) {
-        self->_mutex.release();
+        self->_mutex.unlock();
         return 1;
         return 1;
       }
       }
       self->_status = S_running;
       self->_status = S_running;
       self->_cv.notify();
       self->_cv.notify();
-      self->_mutex.release();
+      self->_mutex.unlock();
     }
     }
 
 
     self->_parent_obj->thread_main();
     self->_parent_obj->thread_main();
@@ -166,14 +166,14 @@ root_func(LPVOID data) {
     }
     }
 
 
     {
     {
-      self->_mutex.acquire();
+      self->_mutex.lock();
       nassertd(self->_status == S_running) {
       nassertd(self->_status == S_running) {
-        self->_mutex.release();
+        self->_mutex.unlock();
         return 1;
         return 1;
       }
       }
       self->_status = S_finished;
       self->_status = S_finished;
       self->_cv.notify();
       self->_cv.notify();
-      self->_mutex.release();
+      self->_mutex.unlock();
     }
     }
 
 
     // Now drop the parent object reference that we grabbed in start(). This
     // Now drop the parent object reference that we grabbed in start(). This

+ 2 - 2
panda/src/putil/bamCache.cxx

@@ -311,7 +311,7 @@ emergency_read_only() {
 void BamCache::
 void BamCache::
 consider_flush_index() {
 consider_flush_index() {
 #if defined(HAVE_THREADS) || defined(DEBUG_THREADS)
 #if defined(HAVE_THREADS) || defined(DEBUG_THREADS)
-  if (!_lock.try_acquire()) {
+  if (!_lock.try_lock()) {
     // If we can't grab the lock, no big deal.  We don't want to hold up
     // If we can't grab the lock, no big deal.  We don't want to hold up
     // the frame waiting for a cache operation.  We can try again later.
     // the frame waiting for a cache operation.  We can try again later.
     return;
     return;
@@ -326,7 +326,7 @@ consider_flush_index() {
   }
   }
 
 
 #if defined(HAVE_THREADS) || defined(DEBUG_THREADS)
 #if defined(HAVE_THREADS) || defined(DEBUG_THREADS)
-  _lock.release();
+  _lock.unlock();
 #endif
 #endif
 }
 }
 
 

+ 4 - 4
panda/src/putil/copyOnWritePointer.cxx

@@ -66,7 +66,7 @@ get_write_pointer() {
 
 
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
 
 
-  _cow_object->_lock_mutex.acquire();
+  _cow_object->_lock_mutex.lock();
   while (_cow_object->_lock_status == CopyOnWriteObject::LS_locked_write &&
   while (_cow_object->_lock_status == CopyOnWriteObject::LS_locked_write &&
          _cow_object->_locking_thread != current_thread) {
          _cow_object->_locking_thread != current_thread) {
     if (util_cat.is_debug()) {
     if (util_cat.is_debug()) {
@@ -89,7 +89,7 @@ get_write_pointer() {
 
 
     PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy();
     PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy();
     _cow_object->CachedTypedWritableReferenceCount::cache_unref();
     _cow_object->CachedTypedWritableReferenceCount::cache_unref();
-    _cow_object->_lock_mutex.release();
+    _cow_object->_lock_mutex.unlock();
 
 
     MutexHolder holder(new_object->_lock_mutex);
     MutexHolder holder(new_object->_lock_mutex);
     _cow_object = new_object;
     _cow_object = new_object;
@@ -112,7 +112,7 @@ get_write_pointer() {
 
 
     PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy();
     PT(CopyOnWriteObject) new_object = _cow_object->make_cow_copy();
     _cow_object->CachedTypedWritableReferenceCount::cache_unref();
     _cow_object->CachedTypedWritableReferenceCount::cache_unref();
-    _cow_object->_lock_mutex.release();
+    _cow_object->_lock_mutex.unlock();
 
 
     MutexHolder holder(new_object->_lock_mutex);
     MutexHolder holder(new_object->_lock_mutex);
     _cow_object = new_object;
     _cow_object = new_object;
@@ -132,7 +132,7 @@ get_write_pointer() {
     // reference.
     // reference.
     _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write;
     _cow_object->_lock_status = CopyOnWriteObject::LS_locked_write;
     _cow_object->_locking_thread = current_thread;
     _cow_object->_locking_thread = current_thread;
-    _cow_object->_lock_mutex.release();
+    _cow_object->_lock_mutex.unlock();
   }
   }
 
 
   return _cow_object;
   return _cow_object;