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
283 B

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