Fixing warnings shouldn't introduce a crasher.

Fix the warning the correct way without making things crash when ENABLE_MUTEX_ERROR_CHECKING is non enabled.

<rdar://problem/17703039>

llvm-svn: 213394
This commit is contained in:
Greg Clayton 2014-07-18 18:32:45 +00:00
parent 32f59d8e1e
commit d46bb62610
1 changed files with 3 additions and 1 deletions

View File

@ -242,9 +242,9 @@ Mutex::Mutex (Mutex::Type type) :
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Mutex::~Mutex() Mutex::~Mutex()
{ {
#if ENABLE_MUTEX_ERROR_CHECKING
int err = ::pthread_mutex_destroy (&m_mutex); int err = ::pthread_mutex_destroy (&m_mutex);
assert(err == 0); assert(err == 0);
#if ENABLE_MUTEX_ERROR_CHECKING
if (err == 0) if (err == 0)
error_check_mutex (&m_mutex, eMutexActionDestroyed); error_check_mutex (&m_mutex, eMutexActionDestroyed);
else else
@ -253,6 +253,8 @@ Mutex::~Mutex()
assert(err == 0); assert(err == 0);
} }
memset (&m_mutex, '\xba', sizeof(m_mutex)); memset (&m_mutex, '\xba', sizeof(m_mutex));
#else
::pthread_mutex_destroy (&m_mutex);
#endif #endif
} }