summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2020-11-22 10:29:40 +0000
committerPaul Buetow <pbuetow@mimecast.com>2020-11-22 10:29:40 +0000
commit97827c2247498eefe0263f043a0cd6eca962077d (patch)
treea7d7cc0756ae24934fc68b5a384e0c2dcb1cba22
parent8f53489b7c017450eb7023698897a3c311c6781b (diff)
add comments
-rw-r--r--.gitignore1
-rw-r--r--internal/done.go4
2 files changed, 5 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 79c20cf..cb47d54 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
*_proprietary.go
cache/
log/
+tags
diff --git a/internal/done.go b/internal/done.go
index 2326eee..54e5e8e 100644
--- a/internal/done.go
+++ b/internal/done.go
@@ -4,21 +4,25 @@ import (
"sync"
)
+// Done is a cleanup/shutdown helper.
type Done struct {
ch chan struct{}
mutex sync.Mutex
}
+// NewDone returns a new cleanup/shutdown helper.
func NewDone() *Done {
return &Done{
ch: make(chan struct{}),
}
}
+// Done returns the done channel (closed when done)
func (d *Done) Done() <-chan struct{} {
return d.ch
}
+// Shutdown closes the done channel. It can be called multiple times.
func (d *Done) Shutdown() {
d.mutex.Lock()
defer d.mutex.Unlock()