Re: cvs commit: src/lib/libthr/thread thr_mutex.c src/lib/libkse/thread thr_mutex.c src/include pthread.h

[ Available lists | Index of cvs-src | Month of Oct 2007 | Week of 30 Oct 2007 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
David Xu <davidxu@FreeBSD.org>
Date
30 Oct 2007 13:16:48
Subject
Re: cvs commit: src/lib/libthr/thread thr_mutex.c src/lib/libkse/thread thr_mutex.c src/include pthread.h
Message-ID
47272EC0.1030204@freebsd.org


[ Hide this part ]
Kris Kennaway wrote:
>
> PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is just in <pthread.h>.
>
> /*
> * Static initialization values.
> */
> #define PTHREAD_MUTEX_INITIALIZER NULL
> #define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP NULL
> #define PTHREAD_COND_INITIALIZER NULL
> #define PTHREAD_RWLOCK_INITIALIZER NULL
>
>>>> I remembered mysql uses this macro to initialize spin mutex, and you
>>>> indead needs a patch to let it work
>>>
>>>
>>> No, with the code I committed mysql detects and uses it out of the
>>> box, without requiring any patches. It is easy to measure the
>>> resulting 30% performance improvement at high loads ;-)
>>>
>> see above, I didn't see any code set PTHREAD_MUTEX_ADAPTIVE_NP type.
>
> The code is already in mysql for use with glibc. It basically does
>
> #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
> /*
> * Use PTHREAD_MUTEX_ADAPTIVE_NP for the mutexes we know will benefit
> * from it
> */
> ...
> #endif
>
> so it just works.
>

I can not find code in libthr setting mutex's member field m_type to
PTHREAD_MUTEX_ADAPTIVE_NP by your change, so how can it work as
expected ?




Elapsed time: 0.205 seconds