V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Jun 10, 2021 · 2337 views
    This topic created in 1794 days ago, the information mentioned may be changed or developed.

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

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

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

    aladdindingding
        1
    aladdindingding  
    OP
       Jun 10, 2021
    或者是两个协程事件绑定,一个退出后另外一个不管运行没有运行完毕也退出
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1071 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 18:37 · PVG 02:37 · LAX 11:37 · JFK 14:37
    ♥ Do have faith in what you're doing.