Skip to content

Instantly share code, notes, and snippets.

@byroot
Created September 28, 2011 15:18
Show Gist options
  • Save byroot/1248208 to your computer and use it in GitHub Desktop.
Save byroot/1248208 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import threading
import subprocess
results = []
def launch_job(arg):
results.append(subprocess.Popen(['/bin/echo %s' % arg], shell=True, stdout=subprocess.PIPE).communicate()[0])
for i in range(100):
thread = threading.Thread(target=launch_job, args=[i])
thread.start()
print results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment