-
-
Save schmir/612150 to your computer and use it in GitHub Desktop.
This file contains 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
#! /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