Simple threading thing

Ype Kingma ykingma at accessforall.nl
Thu Feb 28 15:49:19 EST 2002


Thomas Weholt wrote:
> 
> I got a webserver based on BaseHTTPServer using threads. When it starts I
> want to create a seperate process, a thread, that goes into the background
> and checks the server on given intervals, clearing expired sessions etc. I
> cannot get the created thread to pass control back to the server and let it
> continue. It just sleeps the specified interval and then does it thing then
> sleeps again. The server never gets into action at all.
> 
> Any clues?

You are probably creating a process to work for you on given intervals,
and your server seems to be waiting for that process to finish.

Have a look at the thread and threading modules.
Make a function for your background worker and start this function on 
a separate thread.
The moment this thread sleeps (or earlier) the thread that created
it will continue.

Regards,
Ype



More information about the Python-list mailing list