Re: How to kill a Thread???
Posted By:
fatwiggens_X
Posted On:
Wednesday, October 31, 2001 11:44 AM
Of course stop() is deprecated... that is what my commented code says. And if the thread ran its course properly then of course I could use the flag... The problem is, what if the process in the thread is a run away process. The faq example tells me to get a handle on the running process within the thread. That is not an option in my case. I need a handle to the thread itself. My only option that seems available is to make the same OS stop0() call that Thread.stop() does. I just love how sun deprecates a function but give no viable alternatives.
Re: How to kill a Thread???
Posted By:
Michael_Lueders
Posted On:
Sunday, October 28, 2001 09:44 AM
you can try myThread.interrupt(), but interrupting i/o is flaky and may or may not work, depending on your os. jdk 1.4 is supposed to have support for non-blocking i/o, but, until then, there's no clean way (i know of) to do it.
Re: How to kill a Thread???
Posted By:
Luigi_Viggiano
Posted On:
Friday, October 26, 2001 04:21 PM
The 'stop' is deprecated, as a thread should never be killed suddenly: good programming says that the thread shoud finish normally, setting the 'flag' of your code to false, and avoiding hangs. If your flag is defined as a member instance of your class you can also call it 'stop' an making accessory methods (get/set) to pilot the running thread.