Remove a lock-order inversion in completion reporting
The worker holds the queue lock while acquiring a result lock; the joining thread holds the result lock while closing the queue.
- Focused work estimate
- 4h + prerequisites
- Priority in the scenario
- High
- Engineering practice
- Deadlock analysis · Lock ordering
Estimated field mix
- Systems programming70%
- Quality engineering30%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
A fictional image-indexing utility runs CPU-only synthetic jobs through a Rust worker pool. Its prototype loses wakeups, blocks shutdown, and treats cancellation as completion. Build a local library and deterministic concurrency harness; image content, GPU work, and production deployment are excluded.
Setup prerequisites
- Mutexes and condition variables
- Atomics
- Thread lifecycle
Preceding work
Complete these dependencies, or supply their agreed outputs before taking this ticket.
Acceptance criteria
- Declare a single lock order or remove nested acquisition
- Completion remains visible before join returns
- Shutdown cannot wait while holding a lock needed by workers
Implementation constraints
- Keep callbacks outside internal locks because caller code is untrusted by the synchronization design.
Verification to include
- Complete and join jobs from several workers under the deterministic scheduler.
- Force the prior opposing acquisition order and verify progress.
Deliverables
- Lock graph, refactor, and deadlock regression
Rollout and recovery
Enable lock-wait diagnostics during the local transition.
Value of the work
For the engineer: Practice happens-before reasoning, ownership transfer, cancellation and liveness testing.
For the team: Review a worker primitive whose overload and shutdown behavior are predictable before it supports build or media workloads.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.