1
0
Fork 0

daemon: buffer sighup signal

Resolves: RHEL-31180

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2024-04-04 18:27:13 +02:00
parent 1fb7c803b6
commit ef7cfeb729
No known key found for this signature in database
GPG key ID: D8E1C00E076E840B
2 changed files with 12 additions and 4 deletions

View file

@ -71,10 +71,16 @@ class Controller(tuned.exports.interfaces.ExportableInterface):
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()
if self._daemon._sighup_processing.is_set():
self._daemon._sighup_pending.set()
else:
do_reload = True
while do_reload:
self._daemon._sighup_processing.set()
self._daemon._sighup_pending.clear()
if not self.reload():
self._daemon._sighup_processing.clear()
do_reload = self._daemon._sighup_pending.is_set()
@exports.signal("sbs")
def profile_changed(self, profile_name, result, errstr):

View file

@ -61,6 +61,8 @@ class Daemon(object):
self._not_used = threading.Event()
# Flag which is set if SIGHUP is being processed
self._sighup_processing = threading.Event()
# Flag which is set if there is unprocessed SIGHUP pending
self._sighup_pending = threading.Event()
self._not_used.set()
self._profile_applied = threading.Event()