Skip to content

Instantly share code, notes, and snippets.

@sallysmith1337
Created March 15, 2013 02:01
Show Gist options
  • Save sallysmith1337/5166956 to your computer and use it in GitHub Desktop.
Save sallysmith1337/5166956 to your computer and use it in GitHub Desktop.
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