Struggling to implement parallel foreach...
Kagamin
spam at here.lot
Fri Jun 14 15:02:59 UTC 2019
On Friday, 14 June 2019 at 09:04:42 UTC, Manu wrote:
> Right, exactly... the compile error should be at the assignment
> of the
> not-shared closure to the shared delegate. The error would be
> something like "can't assign `Context*` to `shared(Context)*`".
> So, the function can certainly exist, but for shared, you
> should get
> an error when you attempt to call it passing the closure to the
> function.
The shared function attribute means that its context is shared
similar to object methods, the error is an attempt to implicitly
leak unshared data into that shared context, that's why indeed
function itself is incorrect. Declare the variable as shared and
it will work.
More information about the Digitalmars-d
mailing list