推荐学习书目
› 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
ryanking8215
V2EX  ›  Python

python threading 一定要 join 吗?

  •  
  •   ryanking8215 ·
    ryanking8215 · Jan 29, 2015 · 8357 views
    This topic created in 4297 days ago, the information mentioned may be changed or developed.
    参考pthread,如果不是detach的,需要join(),否则会有内存泄漏。
    python的threaing不join()的话会有内存泄漏吗?pydoc没提。
    8 replies  •  2015-01-31 21:30:39 +08:00
    gdqyn
    gdqyn
    Jan 29, 2015
    1
    在我的实践过程中是见过有的
    gdqyn
    gdqyn
    Jan 29, 2015
    2
    sorry看错了,是Python啊,Python不知道,丢人了
    wuhang89
    wuhang89
    Jan 29, 2015
    3
    看具体项目,不过就python渣一般的线程也真无力吐槽了。
    lazywen
    lazywen
    Jan 29, 2015
    4
    不会内存泄露,看需求join
    zerh925
    zerh925
    Jan 30, 2015
    5
    不一定,join()是等待线程跑完,需要回调函数就join(),否则直接start就行了。
    1989922yan
    1989922yan
    Jan 30, 2015
    6
    @zerh925 看文档中,一定需要join,应该是这样的
    ryanking8215
    ryanking8215
    OP
    Jan 30, 2015
    7
    @1989922yan 文档里没说“一定”
    Other threads can call a thread’s join() method. This blocks the calling thread until the thread whose join() method is called is terminated.

    ‘can’
    inevermore
    inevermore
    Jan 31, 2015
    8
    Python的线程没有detach选项,
    我记得是你得保证main线程一直在运行,就可以不去join
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1424 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 22:46 · PVG 06:46 · LAX 14:46 · JFK 17:46
    ♥ Do have faith in what you're doing.