def _threadProc( self):
		"""This is where the work gets done"""
		while 1:
			if self._threadShouldStop():
				break 
			"""
			If you're waiting on an event in doSomeWorkOrWait that is not expected
			  to return with no activity, then set a largish (~1 second) timeout.
			 If you're using Python 2.2x, you could use generators and yield out
			   every so often.
			"""
			obj.doSomeWorkOrWait( TIMEOUT)
			if obj.workIsFinished()
				break
This is where the work gets done
recipes/Python/82235_Managing_thread_lifetime/recipe-82235.py