pkg/channel/signal.go
2023-09-18 15:51:20 +08:00

24 lines
270 B
Go

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
}