viper-app/pkg/channel/signal.go

24 lines
270 B
Go
Raw Normal View History

package channel
type signal struct{}
var def signal
type Signal chan signal
func NewSingle() Signal {
return make(Signal)
}
func NewBufferSingle(size int) Signal {
return make(Signal, size)
}
func (c Signal) Send() {
c <- def
}
func (c Signal) Read() {
<-c
}