Although I understand the potential dangers of using Thread.stop, it seems to 
me there are cases where its use is legitimate and valuable.

The examples I am thinking of involve a potentially long running computation 
whose result is no longer needed.
In particular, I am thinking of pure computations such as image analysis or 
audio analysis that do not involve waiting (so that interrupt is not useful)
and probably are implemented using some C library (which is not feasible to 
modify to insert code to support graceful interruption).

Is there some alternative that can be used in such cases?

Perhaps a version of stop() that only works if no locks are held?

  Alan





> On Nov 30, 2021, at 7:51 AM, Roger Riggs <rri...@openjdk.java.net> wrote:
> 
> On Tue, 30 Nov 2021 14:52:37 GMT, Alan Bateman <al...@openjdk.org> wrote:
> 
>> Thread.stop is inherently unsafe and has been deprecated since Java 1.2 
>> (1998). It's time to terminally deprecate this method so it can be degraded 
>> and removed in the future.
>> 
>> This PR does not propose any changes to the JVM TI StopThread function (or 
>> the corresponding JDWP command or JDI method).
> 
> Past time for this to go.
> 
> 

Reply via email to