blocking operation
An operation that makes the code wait until something happens, such as a receive waiting for a value to arrive on a channel.
In more detail
Blocking is normal: a waiting task uses no processor time while others run. Problems start when nothing will ever unblock it, which hangs the program or leaks the waiting task. A timeout or cancellation gives a blocked wait an escape.
Example
Go: <-ch blocks until a value arrivesRelated terms
- select statement — A Go statement that waits on several channel operations at once and runs the first one that is ready.
- channel — A typed pipe in Go that one goroutine sends values into and another receives them from, safely handing data between them.
- goroutine leak — A goroutine that never finishes because it is stuck waiting for something that will never happen, slowly wasting memory.
- context deadline — A time limit attached to a context, after which it is cancelled automatically and ctx.Err() reports context.DeadlineExceeded.
Taught in
- The select Statement — Concurrent Systems Programming with Go
- Context Cancellation and Timeouts — Concurrent Systems Programming with Go
- Handling Timeouts and Errors — Concurrent Systems Programming with Go