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

python 中的三种 Queue 有什么区别??

  •  
  •   chu8129 ·
    chu8129 · Apr 9, 2016 · 7301 views
    This topic created in 3832 days ago, the information mentioned may be changed or developed.

    python 中有三种 Queue ;但不是很清楚三个之间的区别;希望了解的大神解释一下:


    import Queue
    myqueue = Queue.Queue()

    from multiprocessing import Queue
    myqueue = Queue.Queue()

    import multiprocessing
    manager=multiprocessing.Manager()
    myqueue=manager.Queue()
    3 replies  •  2016-04-09 20:42:18 +08:00
    icedx
        1
    icedx  
       Apr 9, 2016   ❤️ 1
    Queue.Queue 是进程内非阻塞队列
    multiprocess.Queue 是跨进程通信队列
    前者是各自进程私有, 后者是各子进程共有
    chu8129
        2
    chu8129  
    OP
       Apr 9, 2016
    @icedx 非常感谢;那 manager 那个呢?
    icedx
        3
    icedx  
       Apr 9, 2016
    @chu8129 .Manager 是 multiprocessing 的封装 .Manager.Queue 和 Queue, multiprocessing.Queue 没有太大关系
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2460 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:46 · PVG 13:46 · LAX 22:46 · JFK 01:46
    ♥ Do have faith in what you're doing.