24 lines
270 B
Go
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
|
|
}
|