Hold locks briefly
Four threads export tiles from stdin. Each positive integer is a tile’s input work units; Config uses multiplier 3 to compute its output units. Stats counts completed tiles and output units. A 50 ms sleep models an independent converter wait, not real image processing. Inputs contain at most twelve tiles for Hard, with values at most 1000; Easy/Medium also support their listed larger batches. Timing checks assume ordinary scheduling with enough headroom: sleep and lock APIs promise no upper latency. No worker panics or poisoned locks are in this workload.
What needs to change
Finish the shared export queue exactly once per tile. Let the four workers overlap independent conversion waits so that the run finishes within 250 ms under the stated timing profile.
Reproduce
- Run sample stdin, then compare both totals and the within 250 ms line.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
Edit worker_loop. Config, queue construction, worker joins and the report are supplied.
The queue is complete before workers start. Every occurrence is a separate tile, even when values repeat.
VecDeque::front borrows without removal; pop_front or pop_back removes and returns an owned Option<u64>. An empty queue has no later producer.
Conversion needs only the claimed tile and Config. All timings assume the stated scheduling profile.