Walter is right about transitive readonly - here's the alternative
Janice Caron
caron800 at googlemail.com
Thu Sep 13 04:46:36 PDT 2007
On 9/13/07, Bruno Medeiros <brunodomedeiros+spam at com.gmail> wrote:
> Janice Caron wrote:
> >...
>
> So, does that mean that if I wanted logical constness, but didn't use
> multi-threading at all in my classes with logical constness, I would
> still have to:
>
> a) write my classes with threading constructs as "shared",
> "readable", and "writable", instead of just putting a mutable member?
> b) have performance penalties because of mutex locking/unlocking?
Yes.
However, if Walter is dead set against logical const, we probably
won't be able to persuade him.
That said, if you code up your program using shared, readable and
writable, then I assume it would be possible to add a compiler switch
to that means "compile single threaded". If that were done, the
compiler could optimise away /all/ of the mutex locking and unlocking,
so the performance hit reduces to zero.
(...but you'd have to link with single-threaded versions of phobos, etc.)
More information about the Digitalmars-d
mailing list