[Development] Maintainer changes to review: QMutex optimisations

Thiago Macieira thiago.macieira at intel.com
Sun Aug 26 15:44:05 CEST 2012


On domingo, 26 de agosto de 2012 15.13.30, Olivier Goffart wrote:
> The freelist is O(1) and only used when we actually block. The freelist
> should  only become a bottleneck if it is itself contented. Which only
> happen in a benchmark which does nothing but locking and unlocking
> mutexes.  Any code that does something usefull will put much less
> constraint on the freelist.

The freelist might be O(1), but it has an unbounded time required to allocate, 
that's even before the lock happens. My spinlock implementation is no better 
in that sense, since the spinning might happen forever.

The proper solution for that is to have it allocated at construction time.

With a Double CAS, it might be possible to do that for the Windows and Mac 
semaphore solutions. PThread also allows for static initialisation, but it 
requires a destruction call if the mutex is used.
-- 
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
-------------- 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://lists.qt-project.org/pipermail/development/attachments/20120826/38063261/attachment.sig>


More information about the Development mailing list