You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/common/signal/notifier.go

23 lines
265 B

package signal
type Notifier struct {
c chan bool
}
func NewNotifier() *Notifier {
return &Notifier{
c: make(chan bool, 1),
}
}
func (n *Notifier) Signal() {
select {
case n.c <- true:
default:
}
}
func (n *Notifier) Wait() <-chan bool {
return n.c
}