B
Benji
I'm using Thread.stop() and running into problems. Just to get it out of
the way now, yes, I know it's deprecated, no, I can't use inturrupt.
I'm writing a student code autograder, so I can't guarentee anything
about the student code. This is adversarial programming. =)
The problem is that I can call stop() on a thread, and catch the
ThreadDeath that gets generated, and the thread *seems* to be just fine,
until I wait on a monitor. The object's monitor is definitely signalled,
but the thread never wakes up. It seems that Thread.stop() does more
than it says, because there is nothing about the *monitor* state that is
corrupted, it is that individual thread. (The other threads in the system
can get notified just fine - it's just the thread that was stopped) The
API makes it sound like the only bad state the thread gets in to is that
an unexpected exception can cause inconsistent state in the program - but
the exception isn't even propagating into my code - it's entirely in
student code, so at least according to the documentation, nothing should
be in a bad state.
Is there any way to get around this, or does Thread.stop() make the thread
unusable, and should I just respawn the thread? (I've already done the
latter - I was just curious as to what was going on)
the way now, yes, I know it's deprecated, no, I can't use inturrupt.
I'm writing a student code autograder, so I can't guarentee anything
about the student code. This is adversarial programming. =)
The problem is that I can call stop() on a thread, and catch the
ThreadDeath that gets generated, and the thread *seems* to be just fine,
until I wait on a monitor. The object's monitor is definitely signalled,
but the thread never wakes up. It seems that Thread.stop() does more
than it says, because there is nothing about the *monitor* state that is
corrupted, it is that individual thread. (The other threads in the system
can get notified just fine - it's just the thread that was stopped) The
API makes it sound like the only bad state the thread gets in to is that
an unexpected exception can cause inconsistent state in the program - but
the exception isn't even propagating into my code - it's entirely in
student code, so at least according to the documentation, nothing should
be in a bad state.
Is there any way to get around this, or does Thread.stop() make the thread
unusable, and should I just respawn the thread? (I've already done the
latter - I was just curious as to what was going on)