Resolved mds exit problem

This commit is contained in:
SuperSonic 2020-02-28 20:53:08 +08:00
parent 8f82e6dac2
commit 88e1d14304
4 changed files with 14 additions and 8 deletions

View file

@ -6,7 +6,6 @@ This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
import socket
import time

View file

@ -15,8 +15,8 @@ class Yuuki_Thread:
self.lock = threading.Lock()
@staticmethod
def add(Yuuki_Func, args=()):
added_thread = threading.Thread(name=Yuuki_Func.__name__, target=Yuuki_Func, args=args)
def add(function, args=()):
added_thread = threading.Thread(name=function.__name__, target=function, args=args)
added_thread.start()
@staticmethod
@ -27,7 +27,13 @@ class Yuuki_Thread:
class Yuuki_Multiprocess:
@staticmethod
def add(Yuuki_Func, args=()):
added_multiprocess = multiprocessing.Process(name=Yuuki_Func.__name__, target=Yuuki_Func, args=args)
multiprocess_list = {}
def add(self, function, args=()):
added_multiprocess = multiprocessing.Process(name=function.__name__, target=function, args=args)
self.multiprocess_list[function.__name__] = added_multiprocess
added_multiprocess.start()
def stop(self, function_name):
assert function_name in self.multiprocess_list
self.multiprocess_list[function_name].terminate()

View file

@ -6,7 +6,6 @@ This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
import json
import ntpath
import os

View file

@ -6,9 +6,9 @@ This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
import os
import platform
import time
import random
from git import Repo
@ -130,6 +130,8 @@ class Yuuki:
self.data.updateData(["Global", "Power"], False)
if self.Threading:
self.data.mdsShake("EXT", None, None)
time.sleep(1)
self.data.MdsThreadControl.stop("listen")
if self.YuukiConfigs.get("WebAdmin"):
self.webAdmin.stop()
if restart: