Pattern 4: Condition Variables for Waiting on Shared State
package main
import (
"fmt"
"sync"
"time"
)
type DataStore struct {
data []int
ready bool
mu sync.Mutex
cond *sync.Cond
}
func NewDataStore() *DataStore {
ds := &DataStore{
data: make([]int, 0),
...
hey-there.hashnode.dev2 min read