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

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to