question to start_new_thread in thread

Thomas Schmid t.schmid at gmx.net
Thu Oct 2 08:40:06 EDT 2003


Hi there,

I wrote a tcp server which listens on a port. When he gets a new
connection, he starts a new thread like this:
thread.start_new_thread(self.ConnectionHandler, (conn,))
where conn is the socket for the connection.

After I started the server, I can see one running process under Linux,
which is ok. But once I connected to the Server, I always see two
processes where one is the parent of the other. I think this should be
normal behavier as long as the connection is established. But I also
see two processes when the connection is finished. So I thought that I
don't quit the thread for the connection correctly.  Then I should see
three processes after I started a second connection, but I don't.
There are alwys just the two of them.

My question now is: does python make a thread pool where it does not
really quit the threads but instead reuses them if necessary? Or does
it need a second process to administrate threads?

bye

Thomas




More information about the Python-list mailing list