How to get success/failure in case of thread

vivek at cs.unipune.ernet.in vivek at cs.unipune.ernet.in
Tue Jul 29 04:29:39 EDT 2003


On Mon, Jul 28, 2003 at 08:51:27AM -0500, Skip Montanaro wrote:
> 
>     vivek>   import thread
>     vivek>   thread.start_new_thread(my_func,(args,))
> 
>     vivek> here my_func will return true/1 on success and false/0 on
>     vivek> failure. How can I check whether the function failed/succeeded
>     vivek> ???
> 
> Have the function (or a wrapper function) put() the return value on a Queue
> object, then get() it from there.
>

THX a lot..

But I think it will not work in case if I want to return some value from the 
function. 

Like currently I am trying to implement three tier application using python.

I mean a web server that will serve the http request, depending on the request
it will create an XML string and will pass it to another tier running 
XMLRPCServer. On this tier the XML string will be parsed and will take actions 
accordingly ( like insertion in database etc.) Now I want the SimpleXMLRPCServer
to create a new thread for the request that will process the particular request
and will return the success/failure message. 

How can I do that with the help of queue object?? 

TIA and kind Regards
Vivek Kumar





More information about the Python-list mailing list