[Development] QBasicMutex::lockInternal() race condition?
Tony Van Eerd
tvaneerd at rim.com
Thu Sep 20 18:50:18 CEST 2012
But we already did an acquire earlier when we got the d_ptr the first time. All our instructions on id and waiters happens after that.
If we are worried about ABA on the d_ptr, hmmm, I'd need to think about that.
> -----Original Message-----
> From: development-bounces+tvaneerd=rim.com at qt-project.org
> [mailto:development-bounces+tvaneerd=rim.com at qt-project.org] On Behalf
> Of Thiago Macieira
> Sent: Thursday, September 20, 2012 12:14 PM
> To: development at qt-project.org
> Subject: Re: [Development] QBasicMutex::lockInternal() race condition?
>
> On quinta-feira, 20 de setembro de 2012 15.50.12, Tony Van Eerd wrote:
> > > We check for that case shortly after:
> > >
> > >
> > > 361 if (d != d_ptr.loadAcquire()) {
> > > 362 //Either the mutex is already unlocked, or relocked with
> > > another mutex
> > > 363 d->deref();
> > > 364 continue;
> > > 365 }
> > >
> > >
> >
> > Or course. Very next lines! "shortly after" is a being nice to me.
> Sorry.
> >
> > I wonder if the Acquire couldn't be Relaxed...
>
> Acquire is correct, since we'll use some of the fields that requires
> memory
> ordering, like the id or waiters fields.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel Open Source Technology Center
> Intel Sweden AB - Registration Number: 556189-6027
> Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
More information about the Development
mailing list