Skip to content

Instantly share code, notes, and snippets.

@afaquejam
Created March 30, 2015 10:59
Show Gist options
  • Save afaquejam/b899ea8ad5e40cad31aa to your computer and use it in GitHub Desktop.
Save afaquejam/b899ea8ad5e40cad31aa to your computer and use it in GitHub Desktop.
Threading in Python
import threading
import time
def worker(num, squre):
print ("Worker number: " + str(num))
print ("Squre of the thread number is " + str(squre))
time.sleep(2)
print threading.currentThread().getName()
return
for i in range(5):
t = threading.Thread(name='hey', target = worker, args=(i, i**2))
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment