标签:对象 方式 rom def time getname sleep current set
from threading import Thread,currentThread,enumerate,current_thread,active_count,activeCount
import time
def test():
print("子线程开启")
time.sleep(2)
# print(currentThread())
print("子线程结束")
def daemons():
print("守护进程开启")
time.sleep(1000)
print("守护进程结束")
# t = Thread(target=test)
# t.start()
# enumerate方法
# print(enumerate())
# currentThread()方法和current_thread方法
# print(current_thread())
# print(currentThread())
# is_alive()方法和isAlicv()方法
# print(t.is_alive())
# print(t.isAlive())
# activeCount()方法和active_count()方法
# print(active_count())
# print(activeCount())
# join()方法
# t.join()
# print("主线程")
# 守护线程
dae = Thread(target=daemons,daemon=True)
dae.start()
print("主")
XMind: ZEN - Trial Version
标签:对象 方式 rom def time getname sleep current set
原文地址:https://www.cnblogs.com/marklijian/p/11575135.html