How to kill whole application if child thread raises an exception?
dm via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 26 03:03:30 PDT 2016
On Wednesday, 26 October 2016 at 09:43:10 UTC, rikki cattermole
wrote:
> ```D
> void entryPoint(alias func)() {
> try {
> func();
> } catch (Exception e) {
> import std.stdio;
> writeln(e.toString());
> }
> }
>
> void main() {
> auto tid = spawn(&entryPoint!someFunc);
> // ...
>
> }
> ```
Well... This code shows me:
object.Exception at thread.d(6): I'm an exception
----------------
But my main thread still working :(
Why so strange default behavior do not kill other threads in case
some of threads raise exception?
But thanks anyway.
More information about the Digitalmars-d-learn
mailing list