[D-runtime] A mechanism to kill threads

Alex Rønne Petersen xtzgzorex at gmail.com
Wed May 16 14:19:26 PDT 2012


Well, I'll see if I can conjure some sort of patch for this.

I do have a more technical concern, though: Would a Thread.kill()
function have to acquire the global thread lock to avoid racing
against a world stop? At least the way I see it, that's going to be
necessary.

Regards,
Alex

On Wed, May 16, 2012 at 11:04 PM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Wednesday, May 16, 2012 20:57:15 Alex Rønne Petersen wrote:
>> 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?
>
> Well, I wasn't saying that it's necessarily the case that we shouldn't add it.
> I was pointing out that it's a very unsafe thing to do and rarely needed such
> that it's not exactly surprising that it hasn't been added previously. If
> there's a real use case for it, it makes sense to add it given that it _is_
> something that's platform dependent, and part of the whole point of Thread is
> to provide a platform-independent API for handling threads. It probably
> _should_ have a big fat warning on it though, given that not all developers
> seem to get how insanely bad it is to kill a thread (at least, that seems to
> be the case given some thread-related questions I've seen in the past).
>
> - 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