Created
April 2, 2010 13:41
-
-
Save radiosilence/353145 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 gevent | |
def hello( name ): | |
time.sleep(5) | |
return "Hello, %s!" % name | |
if __name__ == '__main__': | |
names = [ "James", "Ruth" ] | |
jobs = [ gevent.spawn( hello, name ) for name in names ] | |
gevent.joinall( jobs ) | |
for job in jobs: | |
print job.value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment