From ae6b1383635285d8288acc34dd76b16060ed5bf7 Mon Sep 17 00:00:00 2001 From: Burcu Dogan Date: Thu, 18 Feb 2016 20:42:39 -0800 Subject: [PATCH] Clarify chanotify docs about the usage of Add and Close Signed-off-by: Burcu Dogan --- chanotify/chanotify.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chanotify/chanotify.go b/chanotify/chanotify.go index f996421..940cb99 100644 --- a/chanotify/chanotify.go +++ b/chanotify/chanotify.go @@ -19,7 +19,8 @@ type Notifier struct { closed bool } -// New returns a new *Notifier. +// New returns a new notifier. A notifier must be closed by +// calling, (*Notifier).Close, once it is no longer in use. func New() *Notifier { s := &Notifier{ c: make(chan interface{}), @@ -34,7 +35,8 @@ func (n *Notifier) Chan() <-chan interface{} { return n.c } -// Add adds new notification channel to Notifier. +// Add adds new notification channel to the notifier. +// Multiple registrations of the same ID is not allowed. func (n *Notifier) Add(id interface{}, ch <-chan struct{}) error { n.m.Lock() defer n.m.Unlock()