>>>>> "Peter" == peter pilgrim <[EMAIL PROTECTED]> writes:
Peter> I read somewhere that Thread.stop() is now deprecated. Now
Peter> how on earth do we stop a thread...
There are compelling reasons for deprecating this method (along with
Thread.suspend() and Thread.resume()); I understand the second edition
of Doug Lea's excellent book "Concurrent Programming in Java" explains
in detail. I was fortunate to attend a seminar offered by Lea at
OOPSLA '97, during which he offered justification for the pending
removal of these methods.
Peter> The stop() method justs halts the thread object and the garbage
Peter> collector collects any rubbish.
Unfortunately, it isn't that simple. Stopping a thread via
Thread.stop() is a violent act that rips away a thread's context. Lea
writes:
"Thread.stop generates logically asynchronous signals, which means
that activities can be terminated while they are in the midst of
operations or code segments that absolutely must complete for the
sake of program safety and object consistency."
Naturally, there are alternatives to Thread.stop(). See the following
URLs for more information:
http://gee.cs.oswego.edu/dl/cpj/cancel.html
http://www.acl.lanl.gov/Pooma96/abstracts/fleiner.html
Regards,
--
-------------------------------------------------------------
David E. Young
Fujitsu Network Communications "I claim not to have controlled
([EMAIL PROTECTED]) events, but confess plainly
that events have controlled me."
-- Abraham Lincoln (1864)
"Programming should be fun,
programs should be beautiful"
-- P. Graham