aboutsummaryrefslogtreecommitdiffstats
path: root/signal.go
diff options
context:
space:
mode:
Diffstat (limited to 'signal.go')
-rw-r--r--signal.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/signal.go b/signal.go
index 2cefad4..1505593 100644
--- a/signal.go
+++ b/signal.go
@@ -11,6 +11,10 @@ func NewSignal() (s Signal) {
return
}
+func (s *Signal) Close() {
+ close(s.C)
+}
+
func (s *Signal) Disable() {
s.enabled.Set(false)
s.Clear()
@@ -43,7 +47,9 @@ func (s Signal) Clear() {
/* Unblocks all listeners (forever)
*/
func (s Signal) Broadcast() {
- close(s.C)
+ if s.enabled.Get() {
+ close(s.C)
+ }
}
/* Wait for the signal