aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjwbernin <jwbernin@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-02-15 03:32:37 +0000
committerjwbernin <jwbernin@ef72aa8b-4018-0410-8976-d6e080ef94d8>2007-02-15 03:32:37 +0000
commit85d9f6054fac84e2f7f9511acb06e4b1d738b55c (patch)
tree7b0e57bbfba7a70249ce78d638db98c7f9a4fef6 /src
parent381506afc077b5fe029be5b412392e9e565d44a5 (diff)
downloadsos-85d9f6054fac84e2f7f9511acb06e4b1d738b55c.tar.gz
Bit further towards proper interrupt handling
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@73 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src')
-rwxr-xr-xsrc/sosreport14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sosreport b/src/sosreport
index 711475f1..278d1d00 100755
--- a/src/sosreport
+++ b/src/sosreport
@@ -35,19 +35,27 @@ from snack import *
from threading import Thread, activeCount, enumerate
import signal
+__breakHits__ = 0 # Use this to track how many times we enter the exit routine
## Set up routines to be linked to signals for termination handling
def exittermhandler(signum, frame):
doExitCode()
def doExitCode():
- if activeCount() > 1:
+ global __breakHits__
+ __breakHits__ += 1
+ if ( ( activeCount() > 1 ) and ( __breakHits__ == 1 ) ):
print "SIGTERM received, multiple threads detected, waiting for all threads to exit"
for thread in enumerate():
thread.wait()
print "All threads ended, cleaning up."
- else:
- print "SIGTERM received, cleaning up"
+ if ( ( activeCount() > 1 ) and ( __breakHits__ > 1 ) ):
+ print "Multiple SIGTERMs, multiple threads, attempting to signal threads to die immediately"
+ ## FIXME: Add thread-kill code (see FIXME below)
+ print "Threads dead, cleaning up.
+ if ( ( activeCount() == 1 ) and ( __breakHits__ > 2 ) ):
+ print "Multiple SIGTERMs, single thread, exiting without cleaning up.
+ sys.exit(3)
# FIXME: Add code here to clean up /tmp
sys.exit(255)