Created
May 22, 2017 08:54
-
-
Save t27/f9de03a07c2994cbd7f4310cafd4b31f to your computer and use it in GitHub Desktop.
Simple Threading example in python from http://www.saltycrane.com/blog/2008/09/simplistic-python-thread-example/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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