easyconf-lemonbar/easyconf_lemonbar/SignalRouter.py

14 lines
442 B
Python
Raw Normal View History

from signal import pthread_kill
from signal import signal as sigsignal
2023-03-13 01:35:54 +00:00
class SignalRouter:
def __init__(self):
self.signal_thread_dictionary = {}
2023-03-16 01:47:25 +00:00
def __route_signal(self, signal, frame):
pthread_kill(self.signal_thread_dictionary[signal], signal)
def register_signal_thread(self, signal, thread_ident):
self.signal_thread_dictionary[signal] = thread_ident
sigsignal(signal, self.__route_signal)