exiting threads

Aahz Maruch aahz at netcom.com
Thu Jun 29 11:00:00 EDT 2000


In article <8jfmdf$ah6$1 at nnrp1.deja.com>,
Dale Burnett  <denalione at my-deja.com> wrote:
>In article <8jfiuj$lf1$1 at slb1.atl.mindspring.net>,
>  aahz at netcom.com (Aahz Maruch) wrote:
>> In article <8jfcf9$2rp$1 at nnrp1.deja.com>,
>> Dale Burnett  <denalione at my-deja.com> wrote:
>>>
>>>I am using thread.start_new_thread(self.foo,(x,y))
>>>
>>>Do I have to explicitly exit the thread or does it automatically exit
>>>when foo returns?
>>
>> I believe it does, but I strongly recommend that you subclass
>> threading.Thread instead.
>
>why?  because of the greater functionality of threading or is there
>something wrong with thread?

Because if you want to use *any* of the functionality of threading (e.g.
the queue class or semaphore), your threads need to be a subclass of
threading.Thread.  Sure, you say now that you don't need those features,
but why take chances?  threading just makes your life easier.

As a side note, the threading module emulates the Java model fairly
closely, so it helps if there's ever any chance you might use Java.
--
                      --- Aahz (Copyright 2000 by aahz at netcom.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

The best way to get information on Usenet is not to ask a question,
but to post the wrong information.  --Aahz



More information about the Python-list mailing list