Go: Monitor Pattern

Vincent Blanchon
Aug 10, 2019 · 4 min read
Illustration created for “A Journey With Go”, made from the original Go Gopher, created by Renee French.

Go implements the monitor pattern thanks to the sync package and the sync.Cond structure. The monitor pattern allows our goroutines to wait for a specific condition while entering in a sleeping mode without blocking our execution or consuming resources.

Condition variable in action