久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='Dv9kR'></small><noframes id='Dv9kR'>

      <bdo id='Dv9kR'></bdo><ul id='Dv9kR'></ul>
  • <i id='Dv9kR'><tr id='Dv9kR'><dt id='Dv9kR'><q id='Dv9kR'><span id='Dv9kR'><b id='Dv9kR'><form id='Dv9kR'><ins id='Dv9kR'></ins><ul id='Dv9kR'></ul><sub id='Dv9kR'></sub></form><legend id='Dv9kR'></legend><bdo id='Dv9kR'><pre id='Dv9kR'><center id='Dv9kR'></center></pre></bdo></b><th id='Dv9kR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Dv9kR'><tfoot id='Dv9kR'></tfoot><dl id='Dv9kR'><fieldset id='Dv9kR'></fieldset></dl></div>

      <tfoot id='Dv9kR'></tfoot>
    1. <legend id='Dv9kR'><style id='Dv9kR'><dir id='Dv9kR'><q id='Dv9kR'></q></dir></style></legend>

        multiprocessing.Queue 的管道損壞錯誤

        Broken pipe error with multiprocessing.Queue(multiprocessing.Queue 的管道損壞錯誤)
        1. <i id='klIFw'><tr id='klIFw'><dt id='klIFw'><q id='klIFw'><span id='klIFw'><b id='klIFw'><form id='klIFw'><ins id='klIFw'></ins><ul id='klIFw'></ul><sub id='klIFw'></sub></form><legend id='klIFw'></legend><bdo id='klIFw'><pre id='klIFw'><center id='klIFw'></center></pre></bdo></b><th id='klIFw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='klIFw'><tfoot id='klIFw'></tfoot><dl id='klIFw'><fieldset id='klIFw'></fieldset></dl></div>

            • <bdo id='klIFw'></bdo><ul id='klIFw'></ul>
              <legend id='klIFw'><style id='klIFw'><dir id='klIFw'><q id='klIFw'></q></dir></style></legend>
                  <tbody id='klIFw'></tbody>
                • <small id='klIFw'></small><noframes id='klIFw'>

                  <tfoot id='klIFw'></tfoot>

                • 本文介紹了multiprocessing.Queue 的管道損壞錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在 python2.7 中,multiprocessing.Queue 在從函數內部初始化時會引發錯誤.我提供了一個重現問題的最小示例.

                  In python2.7, multiprocessing.Queue throws a broken error when initialized from inside a function. I am providing a minimal example that reproduces the problem.

                  #!/usr/bin/python
                  # -*- coding: utf-8 -*-
                  
                  import multiprocessing
                  
                  def main():
                      q = multiprocessing.Queue()
                      for i in range(10):
                          q.put(i)
                  
                  if __name__ == "__main__":
                      main()
                  

                  拋出下面的斷管錯誤

                  Traceback (most recent call last):
                  File "/usr/lib64/python2.7/multiprocessing/queues.py", line 268, in _feed
                  send(obj)
                  IOError: [Errno 32] Broken pipe
                  
                  Process finished with exit code 0
                  

                  我無法解釋原因.我們不能從函數內部填充 Queue 對象肯定會很奇怪.

                  I am unable to decipher why. It would certainly be strange that we cannot populate Queue objects from inside a function.

                  推薦答案

                  這里發生的是,當你調用 main() 時,它會創建 Queue,放入 10對象并結束函數,垃圾收集其內部的所有變量和對象,包括 Queue.但是您收到此錯誤是因為您仍在嘗試發送 Queue 中的最后一個號碼.

                  What happens here is that when you call main(), it creates the Queue, put 10 objects in it and ends the function, garbage collecting all of its inside variables and objects, including the Queue. BUT you get this error because you are still trying to send the last number in the Queue.

                  來自文檔文檔:

                  "當一個進程第一次將一個項目放入隊列時,一個 feeder 線程是開始將對象從緩沖區傳輸到管道中."

                  "When a process first puts an item on the queue a feeder thread is started which transfers objects from a buffer into the pipe."

                  由于 put() 是在另一個 Thread 中進行的,它不會阻塞腳本的執行,并允許在完成之前結束 main() 函數隊列操作.

                  As the put() is made in another Thread, it is not blocking the execution of the script, and allows to ends the main() function before completing the Queue operations.

                  試試這個:

                  #!/usr/bin/python
                  # -*- coding: utf-8 -*-
                  
                  import multiprocessing
                  import time
                  def main():
                      q = multiprocessing.Queue()
                      for i in range(10):
                          print i
                          q.put(i)
                      time.sleep(0.1) # Just enough to let the Queue finish
                  
                  if __name__ == "__main__":
                      main()
                  

                  應該有一種方法可以加入隊列或阻止執行,直到將對象放入Queue,您應該查看文檔.

                  There should be a way to join the Queue or block execution until the object is put in the Queue, you should take a look in the documentation.

                  這篇關于multiprocessing.Queue 的管道損壞錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                • <legend id='aYD8h'><style id='aYD8h'><dir id='aYD8h'><q id='aYD8h'></q></dir></style></legend>

                      <bdo id='aYD8h'></bdo><ul id='aYD8h'></ul>
                      <tfoot id='aYD8h'></tfoot>
                          <tbody id='aYD8h'></tbody>
                      • <i id='aYD8h'><tr id='aYD8h'><dt id='aYD8h'><q id='aYD8h'><span id='aYD8h'><b id='aYD8h'><form id='aYD8h'><ins id='aYD8h'></ins><ul id='aYD8h'></ul><sub id='aYD8h'></sub></form><legend id='aYD8h'></legend><bdo id='aYD8h'><pre id='aYD8h'><center id='aYD8h'></center></pre></bdo></b><th id='aYD8h'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aYD8h'><tfoot id='aYD8h'></tfoot><dl id='aYD8h'><fieldset id='aYD8h'></fieldset></dl></div>

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

                            主站蜘蛛池模板: 亚洲精品一区二区久 | 亚洲成人黄色 | 午夜欧美a级理论片915影院 | 日韩欧美在线观看视频网站 | 日韩精品免费播放 | 91福利在线观看 | 免费观看一级特黄欧美大片 | 国产99久久久国产精品下药 | 亚洲一区播放 | 亚洲欧美日韩在线 | 国产精品一区二区欧美黑人喷潮水 | 久久久性 | 久久国产精品视频 | 日韩中文字幕 | 伊人精品一区二区三区 | 成人午夜| 国产三级在线观看播放 | 日日草天天干 | 日韩精品一区二区三区中文字幕 | 精品区| 亚洲欧美中文日韩在线v日本 | 久久一二 | 成人中文网 | 国产在线视频在线观看 | 欧美精品在线一区 | 久久人爽爽人爽爽 | 欧美又大粗又爽又黄大片视频 | 人碰人操 | 久久婷婷国产麻豆91 | 久久一| 久久国内 | 操操网站| 很黄很污的网站 | 成人在线电影在线观看 | 综合久久综合久久 | 国产免费一区二区三区免费视频 | 亚洲精品久久久久久宅男 | 精品国产乱码久久久久久闺蜜 | 91综合网 | 91久久精| 成人欧美一区二区三区 |