Created
July 31, 2012 21:18
-
-
Save codingjester/3220655 to your computer and use it in GitHub Desktop.
Python threading really fast
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
#!/usr/bin/env python | |
import threading | |
import Queue | |
import time | |
class Blarg(threading.Thread): | |
def run(self): | |
print time.time() | |
q = Queue.Queue() | |
for i in range(10): | |
b = Blarg() | |
b.start() | |
q.join() |
ah hah! Thanks for that! :D
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also just use futures (back ported to 2.7 - and can be switched to multiprocessing).
I more commonly see: