An important pull request: accessing shared affix for immutable data

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 12 18:21:59 PST 2016


On 12.02.2016 20:12, Andrei Alexandrescu wrote:
>
> * If the buffer is mutable, then the allocator assumes it hasn't been
> shared across threads, so it returns a reference to a mutable affix.
>
> * If the buffer is const, then the allocator must conservatively assume
> it might have been immutable and subsequently shared among threads.
> Therefore, several threads may request the affix of the same buffer
> simultaneously. So it returns a reference to a shared affix.

Const could also mean mutable. This can hence reference the same data as 
both shared and unshared, which violates the type system.


More information about the Digitalmars-d mailing list