On Thursday, 24 de November de 2011 23:49:02 Oswald Buddenhagen wrote: > On Wed, Nov 23, 2011 at 03:35:57PM +0100, ext Thiago Macieira wrote: > > At first thought, I'd say that the pattern class should be a regular, > > implicitly-shared, atomic copy-on-write value class. If you call a > > non-const method, it detaches. > > > > There should be no const methods that modify internal caches. Period. If > > you compile the pattern, it's a non-const method and it detaches. > > that makes lazy compilation really tough to implement ...
Yes and no. Lazy compilation of the pattern is tough to implement, but it's
not because of what I said above. The reason why it's tough is also the reason
why I said what I said above:
You cannot const_cast a shared object without either: atomically detaching or
locking a mutex. If you have a mutex because of the lazy initialisation /
compilation, then you don't need atomic reference counting and detaching. A
single int, protected by the mutex, would be enough.
--
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
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
