I must correct myself:

David Holmes said the following on 02/15/11 10:53:
That said the resume() is bogus anyway:

1. There's nothing in the spec that says that a thread that was suspended which is then stopped should immediately resume so that it can throw the exception. Seems to me it should throw only after being explicitly resumed.

Actually there is, or at least there was in the original spec for Thread.stop in the Java Language Specification first edition. But there's a number of things defined in the THread API in JLS 1ed that never actually made it into the Thread class. To implement this without a race the VM would have to be responsible for doing the resume(), and it's interesting to note that the VM does perform an interrupt on the target thread so that is woken from a sleep (or wait) again as per the original JLS 1e spec.

David
------


2. As there's no synchronization between stop/suspend/resume the thread could be suspended as soon as you've resumed it.


That aside the code changes look code.

Thanks. Let's hope we've finally laid this one to rest!

David

Reply via email to