[IMP] netsvc,openerp-server: fixed daemon threads to work with python 2.5
bzr revid: odo@openerp.com-20100924101354-e020qzylp0kacj8r
This commit is contained in:
parent
46c6906aae
commit
35acf33537
|
@ -350,7 +350,7 @@ class Agent(object):
|
|||
delattr(current_thread, 'dbname')
|
||||
task_thread = threading.Thread(target=function, name='netsvc.Agent.task', args=args, kwargs=kwargs)
|
||||
# force non-daemon task threads (the runner thread must be daemon, and this property is inherited by default)
|
||||
task_thread.daemon = False
|
||||
task_thread.setDaemon(False)
|
||||
task_thread.start()
|
||||
time.sleep(1)
|
||||
time.sleep(60)
|
||||
|
@ -359,7 +359,7 @@ 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.setDaemon(True)
|
||||
agent_runner.start()
|
||||
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ def quit():
|
|||
# to trigger _force_quit() in case some non-daemon threads won't exit cleanly.
|
||||
# threading.Thread.join() should not mask signals (at least in python 2.5)
|
||||
for thread in threading.enumerate():
|
||||
if thread != threading.currentThread() and not thread.daemon:
|
||||
if thread != threading.currentThread() and not thread.isDaemon():
|
||||
while thread.isAlive():
|
||||
# need a busyloop here as thread.join() masks signals
|
||||
# and would present the forced shutdown
|
||||
|
|
Loading…
Reference in New Issue