This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016年08月12日 14:01 by Paulo Gabriel Poiati, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg272540 - (view) | Author: Paulo Gabriel Poiati (Paulo Gabriel Poiati) | Date: 2016年08月12日 14:01 | |
I believe the code example at https://docs.python.org/3.6/library/queue.html is broken. The break condition in the worker loop (when the queued value is None) must call the `task_done` before breaking, otherwise the code blocks indefinitely in the `queue.join()` statement. |
|||
| msg272542 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2016年08月12日 14:42 | |
The example looks correct to me. Have you tested it and seen it hang? The q.join() is done, and returns once all the puts have been processed. *Then* None is put for each worker, which terminates the worker thread. There's no q.join() to block at that point. |
|||
| msg272547 - (view) | Author: Paulo Gabriel Poiati (Paulo Gabriel Poiati) | Date: 2016年08月12日 17:24 | |
You are absolutely right David. I was calling join after putting `None` in the queue. Sorry, I'm closing this. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:34 | admin | set | github: 71934 |
| 2016年08月12日 18:17:31 | r.david.murray | set | type: enhancement -> behavior stage: resolved |
| 2016年08月12日 17:24:36 | Paulo Gabriel Poiati | set | status: open -> closed resolution: not a bug messages: + msg272547 |
| 2016年08月12日 14:42:52 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg272542 |
| 2016年08月12日 14:01:01 | Paulo Gabriel Poiati | create | |