Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
June 14, 2019 [Issue 19956] Subclassing Thread with synchronized (this) may deadlock | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19956 --- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> --- Nice; one reason why synchronized methods are now considered an antipattern in .net is because object's monitor is public and there's no way to restrict access to it, so it can accidentally end up being used in unrelated scenarios. -- |
June 26, 2019 [Issue 19956] Subclassing Thread with synchronized (this) may deadlock | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19956 --- Comment #2 from FeepingCreature <default_357-line@yahoo.de> --- Sure, but even being protected would not have helped here. Maybe `Thread` should be `final`? -- |
June 27, 2019 [Issue 19956] Subclassing Thread with synchronized (this) may deadlock | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19956 --- Comment #3 from anonymous4 <dfj1esp02@sneakemail.com> --- Try to lock a dedicated mutex in BadThread instead of this and see if there's a deadlock. -- |
June 27, 2019 [Issue 19956] Subclassing Thread with synchronized (this) may deadlock | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19956 --- Comment #4 from anonymous4 <dfj1esp02@sneakemail.com> --- Recommended lock pattern in .net: import core.thread; import core.time; class BadThread : Thread { Object locker; this() { locker=new Object; super(&run); } void run() { synchronized (locker) { Thread.sleep(1.seconds); (new Thread({})).start; } } } -- |
December 17, 2022 [Issue 19956] Subclassing Thread with synchronized (this) may deadlock | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19956 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation