[cpp-threads] Somewhat relevant technical report

Alexander Terekhov alexander.terekhov at gmail.com
Sat Dec 17 22:06:58 GMT 2005


On 12/17/05, Peter Dimov <pdimov at mmltd.net> wrote:
> Alexander Terekhov wrote:
> > On 12/17/05, Peter Dimov <pdimov at mmltd.net> wrote:
> > [...]
> >> I agree that the lock/unlock pair prevents this transformation.
> >
> > Nope. A dummy lock can be removed entirely.
>
> It can't unless the compiler can prove that it's not being locked anywhere
> else.

What do you mean by "anywhere else"? Even if compiler doesn't remove
it, implementation of lock() may check old owner thread id and omit
hoist-load barrier (e.g. isync on Power) when old owner is none or
equal to the calling thread.

regards,
alexander.



More information about the cpp-threads mailing list