summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2010-05-24 03:10:10 +0000
committerSol Jerome <solj@ices.utexas.edu>2010-05-24 08:21:28 -0500
commit49006f7886cb9f38a2b7cacd7b7c4ff32934c2b6 (patch)
treec5ea71de8af8089186cf43137c4287608c677e38 /src/lib
parentbd2fe21cec8abc3fb9cb0f61aa7a03944d13a98a (diff)
downloadbcfg2-49006f7886cb9f38a2b7cacd7b7c4ff32934c2b6.tar.gz
bcfg2-49006f7886cb9f38a2b7cacd7b7c4ff32934c2b6.tar.bz2
bcfg2-49006f7886cb9f38a2b7cacd7b7c4ff32934c2b6.zip
Terminate fam thread on shutdown
When the bcfg2-server exits the fam thread is left running which hangs the process on exit. Resolves Ticket #709 git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5863 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Core.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/Server/Core.py b/src/lib/Server/Core.py
index 4e3534c89..f659fec4a 100644
--- a/src/lib/Server/Core.py
+++ b/src/lib/Server/Core.py
@@ -60,6 +60,8 @@ class Core(Component):
self.password = password
self.encoding = encoding
atexit.register(self.shutdown)
+ # Create an event to signal worker threads to shutdown
+ self.terminate = threading.Event()
if '' in plugins:
plugins.remove('')
@@ -111,10 +113,11 @@ class Core(Component):
def _file_monitor_thread(self):
famfd = self.fam.fileno()
- while True:
+ terminate = self.terminate
+ while not terminate.isSet():
try:
if famfd:
- select.select([famfd], [], [])
+ select.select([famfd], [], [], 15)
else:
while not self.fam.pending():
time.sleep(15)
@@ -150,6 +153,7 @@ class Core(Component):
(plugin), exc_info=1)
def shutdown(self):
+ self.terminate.set()
for plugin in self.plugins.values():
plugin.shutdown()