Skip to content

Instantly share code, notes, and snippets.

@tylerfowle
Created August 31, 2018 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerfowle/5b671a2069d183d780250d2c2c8079d5 to your computer and use it in GitHub Desktop.
Save tylerfowle/5b671a2069d183d780250d2c2c8079d5 to your computer and use it in GitHub Desktop.
python threading
import time
from threading import Thread
def myfunc(i):
print("sleeping 5 sec from thread %d" % i)
time.sleep(5)
print("finished sleeping from thread %d" % i)
for i in range(10):
t = Thread(target=myfunc, args=(i,))
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment