守护线程

Posted kuraki

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了守护线程相关的知识,希望对你有一定的参考价值。

import time
from threading import Thread

def func1():
    while True:
        print(**10)
        time.sleep(1)

def func2():
    print(in func2)
    time.sleep(5)

t = Thread(target=func1,)
t.daemon = True
t.start()
t2 = Thread(target=func2,)
t2.start()
# t2.join()
print(主线程)

 

import time
from threading import Thread,Lock

def func():
    print(666)
    time.sleep(10)

def func2():
    pass

t = Thread(target=func)
t.daemon = True
t.start()
print(主线程)

 

以上是关于守护线程的主要内容,如果未能解决你的问题,请参考以下文章