From 35acf33537fcf0fbe8532efe0b0c4b1b55aa986d Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 24 Sep 2010 12:13:54 +0200 Subject: [PATCH] [IMP] netsvc,openerp-server: fixed daemon threads to work with python 2.5 bzr revid: odo@openerp.com-20100924101354-e020qzylp0kacj8r --- bin/netsvc.py | 4 ++-- bin/openerp-server.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index ca81372a8fe..e5a60f9d3ae 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -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() diff --git a/bin/openerp-server.py b/bin/openerp-server.py index 9061b0ae3c8..a1e3c7de0ae 100755 --- a/bin/openerp-server.py +++ b/bin/openerp-server.py @@ -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