Open davewsmith opened 4 years ago
Hi Dave! Good to hear from you. Thank you for the report. Sorry for my delay. This is definitely a bug in the code that was introduced by editing and reordering the code example. The problem here is that the sentinel object used for closing isn't getting removed from the out_queue
in this example:
def game_logic(state, neighbors):
...
raise OSError('Problem with I/O in game_logic')
...
simulate_pipeline(Grid(1, 1), in_queue, out_queue)
Which outputs this:
Traceback ...
OSError: Problem with I/O in game_logic
The above exception was the direct cause of the following exception:
Traceback ...
SimulationError: (0, 0)
To fix this, I need to change the code sample that follows so it cleans things up in the out_queue
appropriately:
I can drive this multi-threaded pipeline for repeated generations by calling
simulate_pipeline
in a loop.
# HIDE
# Clear the sentinel object from the out queue
for _ in out_queue:
pass
...
The text reads "The results are as before," but the 1st and 3rd generations show a dead grid.