summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-08-23 10:29:40 -0700
committerBen Pfaff <blp@nicira.com>2011-08-24 11:57:44 -0700
commit1304578aeb3c57b43fc6634635f880f005a4dec0 (patch)
tree4ad8befb0799a54078d60c9e78db34332a4cd69d
parent71607f575e8eac278b61774faa81fc47b7f8c00b (diff)
downloadopenvswitch-1304578aeb3c57b43fc6634635f880f005a4dec0.tar.gz
ovs.fatal_signal: Reorder definitions to be more easily readable.
Suggested-by: Reid Price <reid@nicira.com>
-rw-r--r--python/ovs/fatal_signal.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/python/ovs/fatal_signal.py b/python/ovs/fatal_signal.py
index 5fca820e6..839df32bb 100644
--- a/python/ovs/fatal_signal.py
+++ b/python/ovs/fatal_signal.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 Nicira Networks
+# Copyright (c) 2010, 2011 Nicira Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,20 +17,8 @@ import logging
import os
import signal
-_inited = False
_hooks = []
-def _init():
- global _inited
- if not _inited:
- _inited = True
-
- for signr in (signal.SIGTERM, signal.SIGINT,
- signal.SIGHUP, signal.SIGALRM):
- if signal.getsignal(signr) == signal.SIG_DFL:
- signal.signal(signr, _signal_handler)
- atexit.register(_atexit_handler)
-
def add_hook(hook, cancel, run_at_exit):
_init()
@@ -119,3 +107,15 @@ def _call_hooks(signr):
for hook, cancel, run_at_exit in _hooks:
if signr != 0 or run_at_exit:
hook()
+
+_inited = False
+def _init():
+ global _inited
+ if not _inited:
+ _inited = True
+
+ for signr in (signal.SIGTERM, signal.SIGINT,
+ signal.SIGHUP, signal.SIGALRM):
+ if signal.getsignal(signr) == signal.SIG_DFL:
+ signal.signal(signr, _signal_handler)
+ atexit.register(_atexit_handler)