Created
May 27, 2017 03:46
-
-
Save wayslog/86e90dae82e0bb82777af2dabc44ad72 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
import gevent.monkey | |
gevent.monkey.patch_all() | |
import time | |
from multiprocessing import Process | |
import gevent | |
import redis | |
from lanaya.invoker.bind import unwrap_bind | |
c = redis.StrictRedis() | |
def greenlet_func(): | |
time.sleep(5) | |
c.incr('count') | |
g = gevent.spawn(greenlet_func) | |
def dummy(): | |
time.sleep(6) | |
# worker = unwrap_bind(dummy) | |
# worker.async_apply() | |
worker = Process(target=dummy) | |
worker.start() | |
worker.join() | |
# worker.complete() | |
g.join() |
测试 redis 里的最后结果是 2 ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lanaya 是我自己的库,这里没用到,可以直接移除。