← Back to team overview

maria-developers team mailing list archive

Re: innobase/sync0policy.h converts opaquepthread_t to ULINT

 

I’m not sure what is the discussion about exactly.
On Linux, pthread_t has exactly the same size as ulint.  On 32bit Linux ,  this

“invalid cast from type ‘os_thread_id_t {aka long unsigned int}’ to type ‘ulint {aka unsigned int}’”

Is a compiler nonsense, because the types are 100% compatible , integral, same size, even same sign-ness.

A cast is appropriate in this case (if sizeof()s do not match, then it is not, but here, it is)
 

From: Sergey Vojtovich
Sent: Monday, April 16, 2018 1:56 PM
To: Sergei Golubchik
Cc: Teodor Mircea Ionita; Vicențiu Ciorbaru; maria-developers@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Maria-developers] innobase/sync0policy.h converts opaquepthread_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))`?

Regards,
Sergey

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

_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : maria-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


References