1. <tfoot id='xTmgv'></tfoot>
      <bdo id='xTmgv'></bdo><ul id='xTmgv'></ul>

    1. <i id='xTmgv'><tr id='xTmgv'><dt id='xTmgv'><q id='xTmgv'><span id='xTmgv'><b id='xTmgv'><form id='xTmgv'><ins id='xTmgv'></ins><ul id='xTmgv'></ul><sub id='xTmgv'></sub></form><legend id='xTmgv'></legend><bdo id='xTmgv'><pre id='xTmgv'><center id='xTmgv'></center></pre></bdo></b><th id='xTmgv'></th></span></q></dt></tr></i><div id='xTmgv'><tfoot id='xTmgv'></tfoot><dl id='xTmgv'><fieldset id='xTmgv'></fieldset></dl></div>
    2. <legend id='xTmgv'><style id='xTmgv'><dir id='xTmgv'><q id='xTmgv'></q></dir></style></legend>

    3. <small id='xTmgv'></small><noframes id='xTmgv'>

    4. Python 队列 get()/task_done() 问题

      Python Queue get()/task_done() issue(Python 队列 get()/task_done() 问题)
        <tfoot id='swgKg'></tfoot>

            <bdo id='swgKg'></bdo><ul id='swgKg'></ul>

              <small id='swgKg'></small><noframes id='swgKg'>

                <tbody id='swgKg'></tbody>
            1. <i id='swgKg'><tr id='swgKg'><dt id='swgKg'><q id='swgKg'><span id='swgKg'><b id='swgKg'><form id='swgKg'><ins id='swgKg'></ins><ul id='swgKg'></ul><sub id='swgKg'></sub></form><legend id='swgKg'></legend><bdo id='swgKg'><pre id='swgKg'><center id='swgKg'></center></pre></bdo></b><th id='swgKg'></th></span></q></dt></tr></i><div id='swgKg'><tfoot id='swgKg'></tfoot><dl id='swgKg'><fieldset id='swgKg'></fieldset></dl></div>

                <legend id='swgKg'><style id='swgKg'><dir id='swgKg'><q id='swgKg'></q></dir></style></legend>

              1. 本文介绍了Python 队列 get()/task_done() 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我的消费者端:

                m = queue.get()
                queue.task_done()
                
                <rest of the program>
                

                问题:

                1. task_done() 是否有效地将 m 从队列中弹出并释放消费者在队列中的所有锁?

                1. Does task_done() effectively pops m off the queue and release whatever locks the consumer has on the queue?

                我需要在程序的其余部分使用 m.它是否安全,或者我需要在调用 task_done() 之前复制它还是 mtask_done() 之后可用?

                I need to use m during the rest of the program. Is it safe, or do I need to copy it before I call task_done() or is m usable after task_done()?

                快乐

                推荐答案

                不,queue.get() 将项目从队列中弹出.在你这样做之后,你可以对它做任何你想做的事情,只要制作者按照它应该的方式工作并且不再触摸它.queue.task_done() 被调用只是为了通知队列你已经完成了某事(它甚至不知道具体的项目,它只是计算队列中未完成的项目),所以 queue.join() 知道工作已经完成.

                No, queue.get() pops the item off the queue. After you do that, you can do whatever you want with it, as long as the producer works like it should and doesn't touch it anymore. queue.task_done() is called only to notify the queue that you are done with something (it doesn't even know about the specific item, it just counts unfinished items in the queue), so that queue.join() knows the work is finished.

                这篇关于Python 队列 get()/task_done() 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
                <i id='zLbew'><tr id='zLbew'><dt id='zLbew'><q id='zLbew'><span id='zLbew'><b id='zLbew'><form id='zLbew'><ins id='zLbew'></ins><ul id='zLbew'></ul><sub id='zLbew'></sub></form><legend id='zLbew'></legend><bdo id='zLbew'><pre id='zLbew'><center id='zLbew'></center></pre></bdo></b><th id='zLbew'></th></span></q></dt></tr></i><div id='zLbew'><tfoot id='zLbew'></tfoot><dl id='zLbew'><fieldset id='zLbew'></fieldset></dl></div>
                  <tbody id='zLbew'></tbody>

                    • <bdo id='zLbew'></bdo><ul id='zLbew'></ul>

                        • <tfoot id='zLbew'></tfoot>

                          <small id='zLbew'></small><noframes id='zLbew'>

                          <legend id='zLbew'><style id='zLbew'><dir id='zLbew'><q id='zLbew'></q></dir></style></legend>