Avoiding race conditions in Python 3's multiprocessing Queues

前端 未结 1 885
忘了有多久
忘了有多久 2021-02-08 05:54

I\'m trying to find the maximum weight of about 6.1 billion (custom) items and I would like to do this with parallel processing. For my particular application there are better a

1条回答
  •  遥遥无期
    2021-02-08 06:43

    You could put a special terminating item, such as None, into the queue. When a worker sees it, it can put it back for the other workers to see, and then terminate. Alternatively, you could put one special terminating item per worker into the queue.

    0 讨论(0)
提交回复
热议问题