[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request: Add spinlocks lock type, based on GCC intrisincs
From:       Michael Pyne <mpyne () kde ! org>
Date:       2012-08-28 22:43:43
Message-ID: 3480746.y5UB0lWRq3 () midna
[Download RAW message or body]


On Wednesday, August 29, 2012 00:36:07 Vadim Zhukov wrote:
> 2012/8/28 Thiago Macieira <thiago@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?

It's correct that the unused[64] is the key to the union.

Since the SharedLock type (including the union) will be placed in shared 
memory it is desired that the size does that structure does not depend on the 
type of lock that is being used.

It is true that once a cache is created with a given locktype that the 
locktype will never change for that cache again, so I suppose this feature is 
not an inherent requirement. I'll look into that too I suppose.

Regards,
 - Michael Pyne
["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic