Python线程。看不到当前状态

时间:2019-04-18 08:50:22

标签: python-3.x

我有4个线程,我想看看它们是否还活着并已正确启动。 is_alive()不返回任何内容,但是在我的日志文件中看到该进程正在运行。


    def session_start()
       while True:
           # here I poll my database and send request and 
           # store response result back to database

    def main():
        session_start_thread = Thread(app.session_start())
        print('Starting thread 1...')
        session_start_thread.start()
        if session_start_thread.is_alive():
            print('Thread 1 is runnning')
        else:
            print("Thread 1 wasn't started")

0 个答案:

没有答案