[Issue 3462] Add a clean way to exit a process.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Sep 17 10:00:22 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=3462

--- Comment #11 from hsteoh at quickfur.ath.cx ---
In that case perhaps the solution is just to assume user code uses
std.concurrency and implement exit() according to how you describe it. If they
don't use std.concurrency, they probably need to implement their own method of
thread control anyway, and so they wouldn't (shouldn't!) be relying on Phobos
to properly shutdown all threads. Of course, this must be documented in big
bold letters (figuratively speaking) in the documention of the prospective
exit() function.

I don't like the idea of throwing from a signal handler -- it's in OS-specific
territory and will probably be very fragile and non-uniform across platforms. I
remember deadalnix's trick of manipulating signal handler return addresses in
order to actually perform the throw outside signal handler context, but this is
Posix-specific and perhaps even Linux-specific, and there is no guarantee
anything of that sort is even implementable across all platforms we support or
will support in the future. Besides, it may not address the problem of shared
resources and potential deadlocks at all, so it's not even a complete solution
to begin with.

--


More information about the Digitalmars-d-bugs mailing list