easyconf-lemonbar/easyconf_lemonbar/SignalRouter.py

13 lines
442 B
Python

from signal import pthread_kill
from signal import signal as sigsignal
class SignalRouter:
def __init__(self):
self.signal_thread_dictionary = {}
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)