diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2020-11-22 10:29:40 +0000 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2020-11-22 10:29:40 +0000 |
| commit | 97827c2247498eefe0263f043a0cd6eca962077d (patch) | |
| tree | a7d7cc0756ae24934fc68b5a384e0c2dcb1cba22 | |
| parent | 8f53489b7c017450eb7023698897a3c311c6781b (diff) | |
add comments
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | internal/done.go | 4 |
2 files changed, 5 insertions, 0 deletions
@@ -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() |
