1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-07 04:24:23 -04:00
v2fly/common/signal/notifier.go
2018-02-08 15:39:46 +01:00

23 lines
283 B
Go

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
}