python程序运行状态:
·运行
·休眠
·等待
·僵尸进程
线程状态
·运行
·等待
·休眠
#!/usr/bin/env python
#coding=utf-8
import threading
import time
tmp = 0
class my_thread(threading.Thread):
def __init__(self, thread_name):
threading.Thread.__init__(self, name=thread_name)
def run(self):
for i in range(10):
time.sleep(1)
print i
'''
Thread run() 函数方法运行
start() 线程方法运行
'''
if __name__ == "__main__":
p1 = my_thread("thread1")
p1.setDaemon(True)
p1.start()
time.sleep(3);
网友评论