how can I tell when a Thread object dies?

yinger ayinger1 at my-deja.com
Tue Nov 7 14:39:04 EST 2000


In article <8u76au$3k8$1 at panix6.panix.com>,
  aahz at panix.com (Aahz Maruch) wrote:
> In article <8u73ne$rea$1 at nnrp1.deja.com>, yinger  <ayinger1 at my-
deja.com> wrote:
> >
> >... I mean besides threadObject.isalive(), because I want to be able
to
> >tell when a thread terminates on a sys.exit() call.
>
> Don't do that.  ;-)  Just use return instead of sys.exit().
>
> If you want to know when a thread finishes, use theadObject.join() or
> something like that.


ok, well, I tried that:
(changed code to return 1 instead of sys.exit(1)) then...

returnValue = threadObject.run()

but it always returns None object

I can't use threadObject.join() because in some cases I don't want to
join the thread.

I even tried making a custom Thread subclass, overriding __init__ and
run methods ... but I still get None object.

So, how do I get return value from a running thread???


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list