# -*- coding: UTF-8 -*-
import time
import threading
def myfunc(i):
time.sleep(5)
print "finished sleeping from thread %d"%(i)
def main():
for i in range(10):
t = threading.Thread(target = myfunc , args=(i,))
time.sleep(1)
t.start()
print t.name
if __name__ == '__main__':
main()
- Apr 07 Mon 2014 14:27
-
python - thread example
請先 登入 以發表留言。