Very limited shared promotion
Walter Bright
newshound2 at digitalmars.com
Sat Jun 22 07:53:49 UTC 2019
On 6/21/2019 5:26 PM, Manu wrote:
> I've asked you 5 or 6 times to show how to pass a pointer to another thread
> without violating scope.
> Can you show it? You keep saying you can.
void foo(scope shared(int)* p) @trusted {
auto t = startThread();
passToThread(t, p);
waitForThreadToExit(t);
}
> You need an acquire fence before the function returns, it's trivial.
That's right it is. But the compiler doesn't know you put one there, and scope
does not cause it to be put there, and @safe does not, either.
> If you want @safe expansion, that's future work, and I personally couldn't care
> less about that work. I can create safe libraries with @trusted functions, and I
> could do it _right now_.
You're assuming semantics for scope and @safe that are not there, and so the
compiler cannot assume them, either.
More information about the Digitalmars-d
mailing list