Created
March 15, 2013 02:01
-
-
Save sallysmith1337/5166956 to your computer and use it in GitHub Desktop.
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 threading | |
import time | |
def cool_function(): | |
print "Herro!" | |
if __name__ == "__main__": | |
thread_limit = 5 | |
while True: | |
while threading.activeCount() >= thread_limit + 1: # (you add one because there is always at least one thread running (the main thread)) | |
# This is a great place to update a progress bar or something | |
time.sleep(0.1) | |
threading.Thread(target=cool_function).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment