Concurrent patterns in Golang: Context

What is concurrency? Concurrent applications have multiple computations executing during overlapping periods of time. Respectively sequential programs in which no computations can be executed in overlapping periods of time. Getting started with Context package The Context package is responsible for signal cancelation and operation deadlines for processes and server requests. The package has an context.Context interface: type Context interface { Deadline() (deadline time.Time, ok bool) Done() <-chan struct{} Err() error Value(key interface{}) interface{} } The interface provides four functions to observe the context state:...

November 29, 2015 · 4 min · Svetlin Ralchev