[IMP] netsvc.Agent: Agent.runner thread should be marked daemon to be terminated at server exit (harmlessly)

Also set a thread name for the runner thread.

bzr revid: odo@openerp.com-20100921153423-053knurknw34qj1r
This commit is contained in:
Olivier Dony 2010-09-21 17:34:23 +02:00
parent 0b314fd3dd
commit bbc9eba7a0
1 changed files with 6 additions and 1 deletions

View File

@ -352,7 +352,12 @@ class Agent(object):
time.sleep(1)
time.sleep(60)
threading.Thread(target=Agent.runner).start()
agent_runner = threading.Thread(target=Agent.runner, name="netsvc.Agent.runner")
# the agent runner is a typical daemon thread, that will never quit and must be
# terminated when the main process exits - with no consequence (the processing
# threads it spawns are not marked daemon)
agent_runner.daemon = True
agent_runner.start()
import traceback