noCV
SCONCUR-104 · Control resources and concurrency

Keep cancellation distinct from successful completion

Practice briefChoreIntermediate

A cancelled indexing job resolves the same completion channel as a finished job, so callers publish an empty index.

Focused work estimate
2h 30m + prerequisites
Priority in the scenario
Medium
Engineering practice
Cancellation · State modeling

Estimated field mix

  • Systems programming70%
  • Real-time systems30%

Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.

Your next step

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

  • Result distinguishes success, cancellation, job failure, and pool shutdown
  • Cancellation before claim prevents execution
  • Cancellation after claim is cooperative and observable

Implementation constraints

  • Do not terminate worker threads asynchronously while they own locks or memory.

Verification to include

  • Cancel queued and running cooperative jobs and inspect distinct outcomes.
  • Use a job that ignores cancellation and verify shutdown reports the unresolved work.

Deliverables

  • Cancellation state model and race tests

Rollout and recovery

Callers must handle cancellation explicitly before adopting the new result type.

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.