Created
September 2, 2014 06:33
-
-
Save tianweidut/595d9d849c982bdff977 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
#coding: utf-8 | |
import gevent | |
import gevent.monkey | |
import urllib2 | |
import time | |
def stop(): | |
print '---start stop' | |
gevent.sleep(0) | |
#time.sleep(0.5) | |
print '---in stop' | |
print '---end stop' | |
def run(): | |
print '^^^^start run' | |
a = urllib2.urlopen('http://daegrade.dapps.douban.com/').read() | |
print '^^^^in run' | |
print '^^^^end run' | |
def main(): | |
g_s = gevent.spawn(stop) | |
g_r = gevent.spawn(run) | |
print 'run---all' | |
print 'run---all2' | |
g_r.join() | |
g_s.join() | |
print 'finish ----' | |
if __name__ == "__main__": | |
#gevent.monkey.patch_all() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment