Rust Send, Sync, and thread boundaries

R-SEND-V4-2medium

Share the totals

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

Let every worker add to the same Stats safely.

Reproduce

  1. Run the program with the sample stdin. The starter does not compile; read the diagnostic before changing the code.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

Edit how Stats is shared: its type in main and in process_job.

Config is already shared with Arc.

Every worker updates processed and total.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in