how to get the return value of a thread?

Antoon Pardon apardon at forel.vub.ac.be
Mon Sep 12 03:18:43 EDT 2005


Op 2005-09-09, Leo Jay schreef <python.leojay at gmail.com>:
> Dear all,
>
> i would like to get the return value of all threads
>
> e.g.
> def foo(num):
>     if num>10:
>         return 1
>     elif num>50:
>         return 2
>     else
>         return 0
>
>
> after i invoked 
> t = thread.start_new_thread(foo,(12,))
> how to get the return value of `foo'?
>
> Thanks
>

Maybe you should have a look at the Future class
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/84317

-- 
Antoon Pardon



More information about the Python-list mailing list