Message from discussion
How to force quit a Thread
Received: by 10.236.165.99 with SMTP id d63mr35507756yhl.7.1335881342826;
Tue, 01 May 2012 07:09:02 -0700 (PDT)
X-BeenThere: android-developers@googlegroups.com
Received: by 10.236.176.198 with SMTP id b46ls6049486yhm.2.gmail; Tue, 01 May
2012 07:07:53 -0700 (PDT)
Received: by 10.236.187.39 with SMTP id x27mr16328476yhm.4.1335881273490;
Tue, 01 May 2012 07:07:53 -0700 (PDT)
Received: by 10.236.187.39 with SMTP id x27mr16328475yhm.4.1335881273472;
Tue, 01 May 2012 07:07:53 -0700 (PDT)
Return-Path: <krsha...@gmail.com>
Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182])
by gmr-mx.google.com with ESMTPS id u47si13207898yhm.4.2012.05.01.07.07.53
(version=TLSv1/SSLv3 cipher=OTHER);
Tue, 01 May 2012 07:07:53 -0700 (PDT)
Received-SPF: pass (google.com: domain of krsha...@gmail.com designates 209.85.160.182 as permitted sender) client-ip=209.85.160.182;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of krsha...@gmail.com designates 209.85.160.182 as permitted sender) smtp.mail=krsha...@gmail.com; dkim=pass header...@gmail.com
Received: by ghrr20 with SMTP id r20so2250264ghr.13
for <android-developers@googlegroups.com>; Tue, 01 May 2012 07:07:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=CQoJCgKiF5TcRt9qgNpsEj/CtV1BNn4kxxJl30Jcq/o=;
b=l0qMSd8rDGEAqC8VZ0dvf3tpDzrZKkIwnPgFc39Pdc6qc3bSsNdyShb8GFNdkKPcDx
8H5l/7usZlgPsrhZMy7BfFhynwzC1bMPxpeIMj2xi/rZDYKis8614KUsXodVx6c04KOw
CrSd7Tq3PTZ56mIqFVwlTQfReAbKyM8QaTDS3lXp1PNUkF+QHWcjOHo9pvZQ7Moesg+Y
7ETHejyAansyJdr/y1E6NyqCSA2p0UUQ87AmTSH8Dp/Y//s2Nhr4VlwKSCj7U+wwSGor
Yddob90HK9vcKAcJEHvjpVsqbxclg8IlqI+tJE1XCma2OeO69vws2rKpekwEgl+4CVpM
x66g==
MIME-Version: 1.0
Received: by 10.236.114.200 with SMTP id c48mr3823333yhh.23.1335881273293;
Tue, 01 May 2012 07:07:53 -0700 (PDT)
Received: by 10.236.161.39 with HTTP; Tue, 1 May 2012 07:07:53 -0700 (PDT)
In-Reply-To: <CAF1Sy-EhRxGEFr1GT+qCDS0=+Ncr0xZ11X1iroBVQi_ogKk...@mail.gmail.com>
References: <24482113.1908.1335758682745.JavaMail.geo-discussion-forums@vbez20>
<CADrT2AN_fWTnJ6=y_tDqbs9Ww4GK15Asz6tLD6Wv_aY31Ox...@mail.gmail.com>
<1462448.2881.1335760437566.JavaMail.geo-discussion-forums@vbli11>
<CAF1Sy-HMwxQSynLXj95X00NTkoN0GYJ9AQRacQ+O7288=X_...@mail.gmail.com>
<7957653.3307.1335770944656.JavaMail.geo-discussion-forums@vbuo17>
<CAF1Sy-GV=_PKPfw2FsJAymHJN0JOMW0N0xr7e3JZ8J5zi2M...@mail.gmail.com>
<17512576.3303.1335859940018.JavaMail.geo-discussion-forums@vbx14>
<CAF1Sy-EhRxGEFr1GT+qCDS0=+Ncr0xZ11X1iroBVQi_ogKk...@mail.gmail.com>
Date: Tue, 1 May 2012 16:07:53 +0200
Message-ID: <CAOZZtKSJg86_ZBB2gbhjZKpM=Z0_PFTNHu6E5ATsJLPFktn...@mail.gmail.com>
Subject: Re: [android-developers] How to force quit a Thread
From: Kamran Shamim <krsha...@gmail.com>
To: android-developers@googlegroups.com
Content-Type: multipart/alternative; boundary=20cf303bfae6c1bc1b04befa18a4
--20cf303bfae6c1bc1b04befa18a4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Kris,
Quite agree. In terms of the service, let's say that at this point it is
not necessary (he GC issue is just a personal thing I have of tidying up
behind me ASAP and making sue that it is done).
For now, I will leave the AsyncTask as my preferred solution for Matt - as
you say the requirements of the thread seem quite simple at this stage.
@Matt, does this help? I would like to read developments.
Kamran
On 1 May 2012 15:59, Kristopher Micinski <krismicin...@gmail.com> wrote:
> On Tue, May 1, 2012 at 4:12 AM, Kamran Shamim <krsha...@gmail.com> wrote:
> > Quite right, Kristopher. I think that it all depends on what Matt would
> like
> > to do.
> > I think that the AsyncTask would do what he wants, but added
> functionality
> > (and therefore perhaps complexity) could be available by using an
> > IntentService, which is a service that automatically runs a worker
> thread as
> > well (pretty simple to implement). I like this as I can bind from
> different
> > activities, if I have to, and if the killing of the thread causes
> problems
> > (which should not happen with the AsyncTask), then at least I can
> "divorce"
> > the service (and therefore the thread) from the activity and UI thread,
> and
> > let the service deal with stopping the thread (which will probably
> cascade
> > from unbinding the service).
>
> If he's just posting stuff to the screen after doing some processing,
> then I don't see any reason why you'd want the extra complication of
> an IntentService.. He didn't mention anything about binding from
> different activities, etc.., so I'm not really sure why there would be
> a win here?
>
> > I am not sure of the risk of delayed garbage collection, but I would
> tend
> > to trust the DVM to deal with this gracefully and punctually - worth an
> > implementation and then testing if we want room for added functionality
> > compared to a service-less thread.
> >
>
> It's not garbage collection you have to worry about per se, it's just
> that starting a service sets up a whole new component that also lives
> in your app, which can be a bit of a memory bear too (though for small
> apps, such as the one the OP is probably writing, it just probably
> isn't worth worrying too much about). Garbage collection and the
> processs lifecycle are somewhat related, though in this case GC is not
> what's holding it back, it's the semantics of the process lifecycle
> for services, (which at some point involves something being garbage
> collected, of course..)
>
> kris
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=3Den
>
--=20
Kamran R. Shamim
26 rue Tonduti de l'Escar=E8ne
06000 Nice
FRANCE
+33 6 7086 2485
+33 4 9304 5857
<http://fr.linkedin.com/in/krshamim>
--20cf303bfae6c1bc1b04befa18a4
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Kris,<div>Quite agree. In terms of the service, let's say that at this =
point it is not necessary (he GC issue is just a personal thing I have of t=
idying up behind me ASAP and making sue that it is done).</div><div>For now=
, I will leave the AsyncTask as my preferred solution for Matt - as you say=
the requirements of the thread seem quite simple at this stage.</div>
<div>@Matt, does this help? I would like to read developments.</div><div><b=
r></div><div>Kamran<br><br><div class=3D"gmail_quote">On 1 May 2012 15:59, =
Kristopher Micinski <span dir=3D"ltr"><<a href=3D"mailto:krismicinski@gm=
ail.com" target=3D"_blank">krismicin...@gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div class=3D"im">On Tue, May 1, 2012 at 4:1=
2 AM, Kamran Shamim <<a href=3D"mailto:krsha...@gmail.com">krshamim@gmai=
l.com</a>> wrote:<br>
> Quite right, Kristopher. I think that it all depends on what Matt woul=
d like<br>
> to do.<br>
> I think that the AsyncTask would do what he wants, but added functiona=
lity<br>
> (and therefore perhaps complexity) could be available by using an<br>
> IntentService, which is a service that automatically runs a worker thr=
ead as<br>
> well (pretty simple to implement). I like this as I can bind from diff=
erent<br>
> activities, if I have to, and if the killing of the thread causes prob=
lems<br>
> (which should not happen with the AsyncTask), then at least I can &quo=
t;divorce"<br>
> the service (and therefore the thread) from the activity and UI thread=
, and<br>
> let the service deal with stopping the thread (which will probably cas=
cade<br>
> from unbinding the service).<br>
<br>
</div>If he's just posting stuff to the screen after doing some process=
ing,<br>
then I don't see any reason why you'd want the extra complication o=
f<br>
an IntentService.. He didn't mention anything about binding from<br>
different activities, etc.., so I'm not really sure why there would be<=
br>
a win here?<br>
<div class=3D"im"><br>
> =A0I am not sure of the risk of delayed garbage collection, but I woul=
d tend<br>
> to trust the DVM to deal with this gracefully and punctually - worth a=
n<br>
> implementation and then testing if we want room for added functionalit=
y<br>
> compared to a service-less thread.<br>
><br>
<br>
</div>It's not garbage collection you have to worry about per se, it=
9;s just<br>
that starting a service sets up a whole new component that also lives<br>
in your app, which can be a bit of a memory bear too (though for small<br>
apps, such as the one the OP is probably writing, it just probably<br>
isn't worth worrying too much about). =A0Garbage collection and the<br>
processs lifecycle are somewhat related, though in this case GC is not<br>
what's holding it back, it's the semantics of the process lifecycle=
<br>
for services, (which at some point involves something being garbage<br>
collected, of course..)<br>
<br>
kris<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
You received this message because you are subscribed to the Google<br>
Groups "Android Developers" group.<br>
To post to this group, send email to <a href=3D"mailto:android-developers@g=
ooglegroups.com">android-developers@googlegroups.com</a><br>
To unsubscribe from this group, send email to<br>
<a href=3D"mailto:android-developers%2Bunsubscribe@googlegroups.com">androi=
d-developers+unsubscribe@googlegroups.com</a><br>
For more options, visit this group at<br>
<a href=3D"http://groups.google.com/group/android-developers?hl=3Den" targe=
t=3D"_blank">http://groups.google.com/group/android-developers?hl=3Den</a><=
/div></div></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><=
div><span style=3D"font-size:x-small"><font color=3D"#6666CC">Kamran R. Sha=
mim</font></span></div>
<div><span style=3D"font-size:x-small"><font color=3D"#6666CC">26 rue Tondu=
ti de l'Escar=E8ne</font></span></div><div><span style=3D"font-size:x-s=
mall"><font color=3D"#6666CC">06000 Nice</font></span></div><div><span styl=
e=3D"font-size:x-small"><font color=3D"#6666CC">FRANCE</font></span></div>
<div><span style=3D"font-size:x-small"><font color=3D"#6666CC"><br></font><=
/span></div><div><span style=3D"font-size:x-small"><font color=3D"#6666CC">=
+33 6 7086 2485</font></span></div><div><span style=3D"font-size:x-small"><=
font color=3D"#6666CC">+33 4 9304 5857</font></span></div>
<div><font color=3D"#6666cc" size=3D"1"><br></font></div><div><a href=3D"ht=
tp://fr.linkedin.com/in/krshamim" target=3D"_blank"><img src=3D"http://www.=
linkedin.com/img/webpromo/btn_viewmy_120x33.png"></a><br></div><br>
</div>
--20cf303bfae6c1bc1b04befa18a4--