[D-runtime] A mechanism to kill threads

Alex Rønne Petersen xtzgzorex at gmail.com
Wed May 16 11:57:15 PDT 2012


Of course it's unsafe, but no less than arbitrarily suspending a
thread. Once you've suspended a thread, you may as well kill it.
You've effectively halted it anyway. We have lots of unsafe primitives
in core.thread already (and my critical regions and cooperative
suspension patches add even more!).

Is there anything speaking against adding this to core.thread with a
big fat "THIS IS UNSAFE" warning?

Regards,
Alex

On Wed, May 16, 2012 at 8:47 PM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Wednesday, May 16, 2012 19:04:48 Alex Rønne Petersen wrote:
>> Hi,
>>
>> In my virtual machine, I need to be able to kill daemon threads on
>> shutdown. The problem is that VM shutdown is *not* tightly coupled to
>> druntime shutdown; multiple VM instances can run in a process at any
>> given time, and can be started/stopped whenever. It doesn't appear
>> like there is any functionality in core.thread to achieve this.
>>
>> Is there any reason we don't have a Thread.kill() function?
>
> Because it's incredibly unsafe? You may have a valid use case for it, but it's
> _not_ something that you should normally be doing.
>
> - Jonathan M Davis
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime


More information about the D-runtime mailing list