Sockets and threads

Peter Hansen peter at engcorp.com
Wed Jun 11 06:35:50 EDT 2003


Byron Morgan wrote:
> 
> If I monitor a socket connection or even jsust listen to a socket in a
> thread, Python's cpu usage expands to use all available processor time.

Let me guess.  Are you using non-blocking sockets and polling them
to see if there's anything to read?  This is a very poor way to do
whatever you're trying to do.  One thing to investigate would be
the select module.  Please post example code to clarify your question.

-Peter




More information about the Python-list mailing list