Serialize SIGHUP processing
Resolves: rhbz#2215298 Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
03375968cd
commit
60d54c3698
3 changed files with 10 additions and 1 deletions
|
|
@ -67,7 +67,7 @@ class Application(object):
|
|||
signal.signal(signal_number, handler_wrapper)
|
||||
|
||||
def _init_signals(self):
|
||||
self._handle_signal(signal.SIGHUP, self._controller.reload)
|
||||
self._handle_signal(signal.SIGHUP, self._controller.sighup)
|
||||
self._handle_signal(signal.SIGINT, self._controller.terminate)
|
||||
self._handle_signal(signal.SIGTERM, self._controller.terminate)
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,12 @@ class Controller(tuned.exports.interfaces.ExportableInterface):
|
|||
def terminate(self):
|
||||
self._terminate.set()
|
||||
|
||||
def sighup(self):
|
||||
if not self._daemon._sighup_processing.is_set():
|
||||
self._daemon._sighup_processing.set()
|
||||
if not self.reload():
|
||||
self._daemon._sighup_processing.clear()
|
||||
|
||||
@exports.signal("sbs")
|
||||
def profile_changed(self, profile_name, result, errstr):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ class Daemon(object):
|
|||
self._terminate_profile_switch = threading.Event()
|
||||
# Flag which is set if there is no operation in progress
|
||||
self._not_used = threading.Event()
|
||||
# Flag which is set if SIGHUP is being processed
|
||||
self._sighup_processing = threading.Event()
|
||||
self._not_used.set()
|
||||
self._profile_applied = threading.Event()
|
||||
|
||||
|
|
@ -203,6 +205,7 @@ class Daemon(object):
|
|||
exports.start()
|
||||
profile_names = " ".join(self._active_profiles)
|
||||
self._notify_profile_changed(profile_names, True, "OK")
|
||||
self._sighup_processing.clear()
|
||||
|
||||
if self._daemon:
|
||||
# In python 2 interpreter with applied patch for rhbz#917709 we need to periodically
|
||||
|
|
|
|||
Loading…
Reference in a new issue