|
|
@@ -26,6 +26,25 @@ MutexHolder(const Mutex &mutex) {
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+// Function: MutexHolder::Constructor
|
|
|
+// Access: Public
|
|
|
+// Description: This variant on the constructor accepts the current
|
|
|
+// thread as a parameter, if it is already known, as an
|
|
|
+// optimization.
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
+INLINE MutexHolder::
|
|
|
+MutexHolder(const Mutex &mutex, Thread *current_thread) {
|
|
|
+#if defined(HAVE_THREADS) || defined(DEBUG_THREADS)
|
|
|
+ _mutex = &mutex;
|
|
|
+ // Actually, the regular Mutex class doesn't need the current thread
|
|
|
+ // parameter at the moment. So not actually an optimization. But
|
|
|
+ // we keep this method because it causes a symmetry with
|
|
|
+ // ReMutexHolder.
|
|
|
+ _mutex->acquire(/*current_thread*/);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: MutexHolder::Constructor
|
|
|
// Access: Public
|