V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
aladdindingding
V2EX  ›  Python

最近在学习 gevent,看了官方文档发现没有自己想要的功能

  •  
  •   aladdindingding · 2021-06-10 16:24:16 +08:00 · 1560 次点击
    这是一个创建于 1023 天前的主题,其中的信息可能已经有所发展或是发生改变。

    gevent 有什么办法可以一个协程结束通知另外一个协程直接退出或者是退出正在阻塞的事情么? 即使另外一个协程正在堵塞中。

    目前的实现是使用 gevent.event()

    while True 一下 然后在阻塞的地方加上超时 等什么时候另外一个协程设置了 event.set() 然后这个现在这个协程就退出。

    aladdindingding
        1
    aladdindingding  
    OP
       2021-06-10 16:33:46 +08:00
    或者是两个协程事件绑定,一个退出后另外一个不管运行没有运行完毕也退出
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2641 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:31 · PVG 23:31 · LAX 08:31 · JFK 11:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.