Cancellation: Go context vs Rust sync stdlib
WHAT IT TESTS: cancellation propagation models. OUTLINE: Go's context.Context threads a Done channel and deadline through call chains; Rust std has no built-in cancellation, so you wire an AtomicBool or channel and check it.
WHAT IT TESTS: understanding that Go has first-class cancellation while Rust std does not. ANSWER OUTLINE: context.Context carries a Done channel, deadline, and request-scoped values; handlers select on ctx.Done to abort and propagate cancellation downstream. Rust's sync std offers no equivalent; you build your own signal with Arc<AtomicBool> or a channel and poll it cooperatively, since neither can interrupt a thread already blocked on IO without a socket deadline. RED FLAG: thinking std can preempt a blocked thread.
Read the original → interview
- #go
- #rust
- #cancellation
- #graceful-shutdown
- #concurrency
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.