Very limited shared promotion

Manu turkeyman at gmail.com
Tue Jun 18 09:01:47 UTC 2019


On Tue, Jun 18, 2019 at 4:30 PM Ola Fosheim Grøstad via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Tuesday, 18 June 2019 at 02:54:10 UTC, Walter Bright wrote:
> > I suggest instead making `x` shared. Then cast it to unshared
> > when protected with a mutex.
>
> Doesn't this imply implementing rust-style borrowing?
> How do you ensure that a reference to unshared isn't retained
> after the mutex is released?

The access function returns a scoped lock object with a ref count. You
may take many read ref's, a write access has a maximum of 1 ref. You
may not take a read and a write lock at the same time.



More information about the Digitalmars-d mailing list