Skip to content

Instantly share code, notes, and snippets.

@schmir
Created October 5, 2010 19:17
Show Gist options
  • Save schmir/612150 to your computer and use it in GitHub Desktop.
Save schmir/612150 to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
from gevent import tlmonkey, spawn, sleep, tpool
tlmonkey.patch_all()
def loop():
while 1:
print "hello"
sleep(5)
def read_input():
while 1:
s = tpool.spawn(raw_input).get()
print "got:", s
g1 = spawn(loop)
g2 = spawn(read_input)
g1.join()
g2.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment