mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-14 23:25:25 +03:00
Use threading Event for process stop
Python's multiprocessing.Event does not like being called from signal handlers. Another option would be to start a thread to set the stop_event on receiveSignal, but that seems unnecessary.
This commit is contained in:
parent
e204dfc1c3
commit
5df681697e
@ -3,9 +3,9 @@ import logging
|
|||||||
import multiprocessing as mp
|
import multiprocessing as mp
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
|
import threading
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from logging.handlers import QueueHandler
|
from logging.handlers import QueueHandler
|
||||||
from multiprocessing.synchronize import Event
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import frigate.log
|
import frigate.log
|
||||||
@ -51,12 +51,12 @@ class BaseProcess(mp.Process):
|
|||||||
|
|
||||||
class Process(BaseProcess):
|
class Process(BaseProcess):
|
||||||
logger: logging.Logger
|
logger: logging.Logger
|
||||||
stop_event: Event
|
stop_event: threading.Event
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stop_event(self) -> Event:
|
def stop_event(self) -> threading.Event:
|
||||||
if "stop_event" not in self.__dict__:
|
if "stop_event" not in self.__dict__:
|
||||||
self.__dict__["stop_event"] = mp.Event()
|
self.__dict__["stop_event"] = threading.Event()
|
||||||
return self.__dict__["stop_event"]
|
return self.__dict__["stop_event"]
|
||||||
|
|
||||||
def before_start(self) -> None:
|
def before_start(self) -> None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user