On 07/01/16 19:26, richard kappler wrote: > The brief version, I am reading and parsing a data stream through a socket, > several actually. Each new connection spawns a thread that reads and > parses. Should the client close, I want the thread to terminate.
Just another thought. Have you looked at asyncore yet? It seems ideally suited to your usecase and avoids all the threading problems (or more accurately lets Python deal with it invisibly) I mentioned it right at the start of your project but haven't brought it up again. Now seems like a good time. It's a bit like Node.JS for Python. It allows you to add jobs to an asynchronous event loop which then processes those events in the background (using a thread pool I believe). It looks like a good match to your use case. The docs provide several examples and there are several tutorials online. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor