RFC: Change what killing a thread does on error instead

Sebastiaan Koppe mail at skoppe.eu
Tue Jul 8 20:24:06 UTC 2025


On Tuesday, 8 July 2025 at 19:55:13 UTC, Dukc wrote:
> That's an interesting idea actually. I think we still should 
> have some mechanism for another thread to handle a thread death 
> but maybe catching another error at another thread isn't the 
> way.
>
> Instead, maybe some thread could register a death handler 
> delegate (thread gravedigger?) that is called if another thread 
> dies. If there is no gravedigger, or if the only gravedigger 
> thread itself dies, then all others would immediately receive 
> an unrecoverable error, and the error from the dead thread 
> would be what is reported.

That is similar to what happens with structured concurrency. For 
every execution context there is always an owner to which any 
Error gets forwarded to, all the way up to the main thread.

It would be straightforward to change that so that it terminates 
the process on the spot, but I prefer graceful shutdown instead.


More information about the Digitalmars-d mailing list