github.com/grafana/synthetic-monitoring-agent@v0.64.2/internal/pusher/v2/condition.go (about) 1 package v2 2 3 // condition is a simple, channel-based condition variable. 4 type condition chan struct{} 5 6 // Signal signals the condition. Waking up a waiting goroutine. 7 func (c condition) Signal() { 8 select { 9 case c <- struct{}{}: 10 default: 11 // Already signaled 12 } 13 } 14 15 // C returns the channel used for waiting. 16 func (c condition) C() <-chan struct{} { 17 return c 18 } 19 20 func newCondition() condition { 21 return make(chan struct{}, 1) 22 }