[cse491] homework4 question

Alex Nolley nolleyal at msu.edu
Sat Sep 20 19:34:17 PDT 2008


I'm a little uncertain about some code I have in my homework 4 webserver.
Since our program has to catch any exceptions that occur in the threads, I
first make a thread t that contains the info to spawn a client connection.
Next, I spawn the thread in a try, except clause where the except will catch
any exception, print out it's information to standard output and then pass
and continue with a new thread. The code is similar to this:

 

while 1:

# Setup the connection stuff

t = threading.Thread(target=handle_connection, args(client_sock,))

try:

                                t.start()

except:

                                print "An exception happened:",
sys.exc_info()[0]

 

Will this code allow for true mulit-threading or does the try, except clause
prevent that from happening?

 

Thanks,

Alex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/cse491-fall-2008/attachments/20080920/d9b13ce2/attachment.html 


More information about the cse491-fall-2008 mailing list