Is it possible to stop a specific application thread?

David Holmes david.holmes at oracle.com
Mon Nov 11 16:26:00 PST 2013


Hi Keith,

On 12/11/2013 6:29 AM, Keith Chapman wrote:
> Hi,
>
> I'm playing around with some research ideas on hotspot.
>
> One of my runtime services of the VM needs to stop a specific application
> thread (I have a handle to the pthread of the application thread). How can
> the VM stop such a thread? Is there any mechanism in place to do this?

There is no general purpose mechanism currently in place.

You could use the deprecated and inherently dangerous Thread.suspend 
mechanism (either directly or via the JVMTI suspension interface).

Or if you are more adventurous with your VM hacking you could introduce 
a per-thread safepoint operation to cause it to stop. Or you could hack 
in a special "magic exception" type the processing of which simply 
blocks the thread until "resumed" somehow (not sure how ??). Or ...

Cheers,
David

> Thanks,
> Keith.
>


More information about the hotspot-dev mailing list