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()

相关文章:

  • 2021-04-03
  • 2022-02-19
  • 2022-12-23
  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2021-05-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2021-12-22
  • 2021-10-04
  • 2021-10-17
  • 2021-06-01
相关资源
相似解决方案