Made DRD_(mutex_type) ignore mutex attribute flags.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9399
This commit is contained in:
Bart Van Assche 2009-03-13 17:32:52 +00:00
parent 22b77e39d7
commit 740d45422c

View File

@ -156,15 +156,18 @@ static MutexT DRD_(pthread_to_drd_mutex_type)(const int kind)
* which the mutex type is stored.
* @note The function mutex_type() has been declared inline in order
* to avoid that it shows up in call stacks (drd/tests/...exp* files).
* @note glibc stores the mutex type in the lowest two bits, and uses the
* higher bits for flags like PTHREAD_MUTEXATTR_FLAG_ROBUST and
* PTHREAD_MUTEXATTR_FLAG_PSHARED.
*/
static __inline__ MutexT DRD_(mutex_type)(pthread_mutex_t* mutex)
{
#if defined(HAVE_PTHREAD_MUTEX_T__M_KIND)
/* glibc + LinuxThreads. */
const int kind = mutex->__m_kind;
const int kind = mutex->__m_kind & 3;
#elif defined(HAVE_PTHREAD_MUTEX_T__DATA__KIND)
/* glibc + NPTL. */
const int kind = mutex->__data.__kind;
const int kind = mutex->__data.__kind & 3;
#else
/* Another POSIX threads implementation. Regression tests will fail. */
const int kind = PTHREAD_MUTEX_DEFAULT;