Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 24, 2021 [Issue 6747] Implicitly allowing objects which contain delegates to be shared/immutable can cause races | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6747 mhh <maxhaton@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxhaton@gmail.com Severity|enhancement |normal --- Comment #1 from mhh <maxhaton@gmail.com> --- Still a problem BUT @safe does catch the problem in it. https://d.godbolt.org/z/Px5aTM ------------------ import std.algorithm; import std.stdio; import std.traits; class Foo //@safe can catch the bug with ref { immutable this(ref int _i) { dg = (){++_i;}; } void delegate() dg; } immutable Foo f; int notShared; shared static this() { f = new immutable Foo(notShared); } void sharedInc(immutable Foo x) { x.dg(); } void main() { import std.stdio; import std; f.dg(); f.dg(); f.dg(); auto file1Task = task!sharedInc(f); file1Task.executeInNewThread(); // Read bar.txt in parallel. sharedInc(f); // Get the results of reading foo.txt. file1Task.yieldForce; } -- |
January 24, 2021 [Issue 6747] Implicitly allowing objects which contain delegates to be shared/immutable can cause races | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6747 --- Comment #2 from Steven Schveighoffer <schveiguy@gmail.com> --- The ref is incidental. Using pointers it compiles: class Foo { this(int *_i) immutable @safe { dg = (){return _i;}; } int* delegate() dg; } immutable Foo f; int notShared; shared static this() { f = new immutable Foo(¬Shared); } -- |
December 17, 2022 [Issue 6747] Implicitly allowing objects which contain delegates to be shared/immutable can cause races | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6747 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P3 -- |
December 13 [Issue 6747] Implicitly allowing objects which contain delegates to be shared/immutable can cause races | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6747 --- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18373 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation