Review Request: Add spinlocks lock type, based on GCC intrisincs

Thiago Macieira thiago at kde.org
Tue Aug 28 23:37:20 BST 2012


On quarta-feira, 29 de agosto de 2012 00.36.07, Vadim Zhukov wrote:
> 2012/8/28 Thiago Macieira <thiago at kde.org>:
> > On terça-feira, 28 de agosto de 2012 12.28.24, Vadim Zhukov wrote:
> >> See the definition of SharedLock structure in kshareddatacache_p.h.
> >> Actually, other union members will not be accessed simultaneously with
> >> spinlock, but compiler doesn't know about that.
> > 
> > I don't see the need for a union.
> > 
> > The other types aren't related to a spinlock.
> 
> The main thing there is "char unused[64]" below. The union is needed
> to keep the size of the whole structure constant. Or... is it
> impossible that there will be run two KDE-based apps with size of Qt
> atomic type simultaneously; e.g. during OS update?

The union is useless. If the size of the structure changed, the cross-process 
locking would stop working completely.

And in any case, if you're using a spinlock, you're not using a pthread_mutex. 
You don't need it, so remove it.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120829/9209c37c/attachment.sig>


More information about the kde-core-devel mailing list