Skeleton ready
This commit is contained in:
0
kernel/application/manager/__init__.py
Normal file
0
kernel/application/manager/__init__.py
Normal file
13
kernel/application/manager/stop_event.py
Normal file
13
kernel/application/manager/stop_event.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from asyncio import Event
|
||||
from signal import signal, SIGINT, SIGTERM
|
||||
|
||||
class StopEvent:
|
||||
__event: Event
|
||||
|
||||
def __init__(self, event: Event) -> None:
|
||||
self.__event = event
|
||||
|
||||
def setup_stop_signals(self) -> None:
|
||||
for signum in (SIGINT, SIGTERM):
|
||||
signal(signum, lambda sig, frame: self.__event.set())
|
||||
|
||||
Reference in New Issue
Block a user