|
1234567891011121314151617181920212223 |
- from threading import Thread
- from loguru import logger
-
-
- class Common(Thread):
-
- __slots__ = ('__func', '__param1', '__param2', '__result')
-
- def __init__(self, func, param1, param2):
- super(Common, self).__init__()
- self.__func = func
- self.__param1 = param1
- self.__param2 = param2
- self.__result = None
-
- def get_result(self):
- self.join()
- return self.__result
-
- def run(self):
- logger.info("开始执行线程!")
- self.__result = self.__func(self.__param1, self.__param2)
- logger.info("线程停止完成!")
|