from threading import Thread
from loguru import logger


class Common(Thread):

    def __init__(self, func, args=()):
        super(Common, self).__init__()
        self.func = func
        self.args = args
        self.result = None

    def get_result(self):
        self.join(60 * 60 * 3)
        return self.result

    def run(self):
        logger.info("开始执行线程！")
        self.result = self.func(self.args)
        logger.info("线程停止完成！")
