Skip to content

Instantly share code, notes, and snippets.

@nim4n136
Created June 22, 2020 21:34
Show Gist options
  • Save nim4n136/417a19999552f3b64697492465fe0d37 to your computer and use it in GitHub Desktop.
Save nim4n136/417a19999552f3b64697492465fe0d37 to your computer and use it in GitHub Desktop.
Multi thread python
import threading
import time
def excute_program(x):
print(x)
time.sleep(100)
lst_thread = range(10000)
worker_list = []
for i in lst_thread:
t = threading.Thread(
target=excute_program, args=(i, ), daemon=True)
worker_list.append(t)
for worker in worker_list:
worker.start()
for worker in worker_list:
worker.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment