RFC: Change what killing a thread does on error instead
Dukc
ajieskola at gmail.com
Tue Jul 8 20:35:42 UTC 2025
On Tuesday, 8 July 2025 at 20:24:06 UTC, Sebastiaan Koppe wrote:
>> 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.
I think you misunderstood. There would be no thread-specific
owner, only a global handler for all others and maybe a backup
handler in case the gravedigger itself dies.
But, guaranteeing that each thread has an owner is certainly an
excellent concept too. I would maybe not go for that in this case
though. Not because I'd consider structured concurrency inferior
(rather the opposite in fact), but because the solution should
preferably work with existing client code.
More information about the Digitalmars-d
mailing list