How to get success/failure in case of thread
Aahz
aahz at pythoncraft.com
Mon Jul 28 14:49:03 EDT 2003
In article <mailman.1059397780.20866.python-list at python.org>,
<vivek at cs.unipune.ernet.in> wrote:
>
> I am trying to learn using threads in python. But the main problem I am
>facing is how to check whether the function called using a thread succeeded or
>failed. like when I call:
> import thread
> thread.start_new_thread(my_func,(args,))
>
>here my_func will return true/1 on success and false/0 on failure. How can I
>check whether the function failed/succeeded ???
While Queue is probably the best way, you could also subclass from
threading.Thread, call your function from the run() method, then set an
instance attribute.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
This is Python. We don't care much about theory, except where it intersects
with useful practice. --Aahz
More information about the Python-list
mailing list