18
func NewConditionVariable(
19
lock Locker,
21
>
return &ConditionVariableImpl{
22
>
lock: lock,
23
>
24
>
chanLock: sync.Mutex{},
25
>
channel: newCVChannel(),
26
>
}
27
>
}
28
29
// Signal wakes one goroutine waiting on this condition variable, if there is any.
31
>
c.chanLock.Lock()
32
>
defer c.chanLock.Unlock()
33
>
34
>
select {
35
>
case c.channel <- struct{}{}:
36
default:
37
// noop