← Back to team overview

maria-developers team mailing list archive

Re: innobase/sync0policy.h converts opaque pthread_t to ULINT


Hi Sergei,

If you disable just DebugMutex but leave UNIV_DEBUG enabled, how do you make
assertions like this work properly: `ut_ad(mutex_own(&mutex))`?


On Mon, Apr 16, 2018 at 01:30:33PM +0200, Sergei Golubchik wrote:
> Hi, Sergey!
> On Apr 16, Sergey Vojtovich wrote:
> > 
> > Something similar (HAVE_IB_ATOMIC_PTHREAD_T_GCC) was removed in
> > 2b47f8ff03845f7ffe2fa3bd583dd4123dae2b61. IIRC the reason was: relevant code
> > didn't follow this macro properly and this code was still functional.
> > 
> > You may use os_thread_pf(os_thread_get_curr_id()) to cast it to ulint. Yes, it
> > is unsafe. But I'd leave it this way assuming it works. This code is subject for
> > refactoring and I would avoid further spread of hacks.
> Exactly. It's DebugMutex and I'd say it's not worth fixing for cases
> when pthread_t doesn't fit in ulint. DebugMutex is completely disabled
> in non-debug builds anyway.
> If we'll ever have a bug that would need DebugMutex to analyze and
> cannot be repeated on a platform where pthread_t fits in ulint... in
> that case it might make sense to get back to this. Until then I'd just
> wouldn't compile DebugMutex where it doesn't work.
> Regards,
> Sergei
> Chief Architect MariaDB
> and security@xxxxxxxxxxx

Follow ups