diff --git a/dtool/src/dtoolbase/mutexImpl.h b/dtool/src/dtoolbase/mutexImpl.h index fbb2e29c2d..84da41dc72 100644 --- a/dtool/src/dtoolbase/mutexImpl.h +++ b/dtool/src/dtoolbase/mutexImpl.h @@ -47,6 +47,21 @@ typedef ReMutexPosixImpl ReMutexImpl; #endif +// Also define what a true OS-provided lock will be, even if we don't +// have threading enabled in the build. Sometimes we need to +// interface with an external program or something that wants real +// locks. +#if defined(WIN32_VC) +typedef MutexWin32Impl TrueMutexImpl; + +#elif defined(HAVE_POSIX_THREADS) +typedef MutexPosixImpl TrueMutexImpl; + +#else +// No true threads, sorry. Better not try to use 'em. + +#endif + #endif diff --git a/dtool/src/dtoolbase/mutexPosixImpl.I b/dtool/src/dtoolbase/mutexPosixImpl.I index b114581b03..4ed6054750 100644 --- a/dtool/src/dtoolbase/mutexPosixImpl.I +++ b/dtool/src/dtoolbase/mutexPosixImpl.I @@ -78,6 +78,16 @@ release() { assert(result == 0); } +//////////////////////////////////////////////////////////////////// +// Function: MutexPosixImpl::get_posix_lock +// Access: Public +// Description: Returns the underlying Posix lock handle. +//////////////////////////////////////////////////////////////////// +INLINE pthread_mutex_t *MutexPosixImpl:: +get_posix_lock() { + return _lock; +} + //////////////////////////////////////////////////////////////////// // Function: ReMutexPosixImpl::Constructor // Access: Public @@ -142,3 +152,13 @@ release() { int result = pthread_mutex_unlock(&_lock); assert(result == 0); } + +//////////////////////////////////////////////////////////////////// +// Function: ReMutexPosixImpl::get_posix_lock +// Access: Public +// Description: Returns the underlying Posix lock handle. +//////////////////////////////////////////////////////////////////// +INLINE pthread_mutex_t *ReMutexPosixImpl:: +get_posix_lock() { + return _lock; +} diff --git a/dtool/src/dtoolbase/mutexPosixImpl.h b/dtool/src/dtoolbase/mutexPosixImpl.h index 4702b2dbea..7f506e1324 100644 --- a/dtool/src/dtoolbase/mutexPosixImpl.h +++ b/dtool/src/dtoolbase/mutexPosixImpl.h @@ -37,6 +37,8 @@ public: INLINE bool try_acquire(); INLINE void release(); + INLINE pthread_mutex_t *get_posix_lock(); + private: pthread_mutex_t _lock; friend class ConditionVarPosixImpl; @@ -55,6 +57,8 @@ public: INLINE bool try_acquire(); INLINE void release(); + INLINE pthread_mutex_t *get_posix_lock(); + private: pthread_mutex_t _lock; };