X-Received: by 10.224.171.72 with SMTP id g8mr4790741qaz.7.1375374632571; Thu, 01 Aug 2013 09:30:32 -0700 (PDT) X-Received: by 10.182.181.42 with SMTP id dt10mr8118obc.16.1375374632544; Thu, 01 Aug 2013 09:30:32 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!fx3no438337qab.0!news-out.google.com!he10ni0qab.0!nntp.google.com!fx3no438334qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.programmer Date: Thu, 1 Aug 2013 09:30:32 -0700 (PDT) In-Reply-To: <51fa7dea$0$298$14726298@news.sunsite.dk> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=128.154.209.199; posting-account=joYf0QoAAABuKpgQQh7YUEwuKkFQczA8 NNTP-Posting-Host: 128.154.209.199 References: <8fe57dc2-a323-4821-941c-4036663cbce5@googlegroups.com> <51f9df70$0$52766$742ec2ed@news.sonic.net> <7bf3ea0e-533b-4cfe-a85d-ad75b5d3657c@googlegroups.com> <51fa7dea$0$298$14726298@news.sunsite.dk> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: What is so bad aboud Thread.stop() ? From: taqmcg@gmail.com Injection-Date: Thu, 01 Aug 2013 16:30:32 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.java.programmer:24872 On Thursday, August 1, 2013 11:25:25 AM UTC-4, Arne Vajh=F8j wrote: > On 8/1/2013 11:00 AM, usvirtualobservatory@gmail.com wrote: >=20 > I think it is something like: >=20 >=20 >=20 > You can achieve what you want to do in two ways:=20 > A) use Thread.stop > B) set a flag and let the thread do what it need to do to > terminate in a graceful manner >=20 >=20 > #A can be done safely in some cases and can not be done safely in > other cases. Even if it can be done safely, then it will require > significant analysis to get it right. And even if it gets done > right, then there is a high risk that that a bug will be introduced > during maintenance later, because the maintenance programmer do not > have the skill or the time to understand the subtleties of the > problem. >=20 >=20 >=20 > #B can always be done safely. It requires not much work. And > is relative maintenance friendly. >=20 > Easy choice in my opinion. >=20 > Arne Sure... If you control all the code, and your code has no bugs in it (so t= hat no infinite loop occurs somewhere you didn't expect). That's not alway= s the case -- I certainly expect that my code has bugs and I use a fair num= ber of external libraries which may have bugs of there own. Since most of my task code is single threaded and numerical, and I'd plan o= n throwing away anything touched by a killed thread, a lot of the concerns = that are brought up seem more handleable than might be the case in other ap= plications. Tom