On Wed, Sep 5, 2012 at 2:40 PM, Liviu Nicoara <nikko...@hates.ms> wrote:
> I am afraid this would be unsafe, too (if I said otherwise earlier I was > wrong). The compiler might re-arrange the protected assignments, such that > another thread sees a partially updated object, where the flags are updated > and the string not. I don't think we're going to get away with this here > without either a simpler and more inefficient top-level locking, or doing > away completely with the lazy initialization. Thoughts? Yes -- there's the reordering stuff which is almost guaranteed to happen on SPARC. But then there's another aspect -- which I probably failed to highlight in my previous email: the per-object mutex implementation is 20% *slower* than the class-static mutex implementation. class-static implementation: real 2139.31 user 2406.09 sys 155.61 pe-object implementation: real 2416.75 user 2694.64 sys 159.49 --Stefan -- Stefan Teleman KDE e.V. stefan.tele...@gmail.com