import threading
lock = threading.Lock()

def th_001(req):
lock.acquire()
print(req,time.asctime())
lock.release()

def test():
pool=[]
for i in range(1000):
th=threading.Thread(target=th_001,args=(i,))
th.start()
pool.append(th)
for t in pool:
t.join()


if __name__ == '__main__':

test()