diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-03 16:57:24 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-03 16:57:24 -0600 |
commit | 82de0f5ad450f3add2a8e7674cf5e019af609a66 (patch) | |
tree | 235460147ae873e27113b4f95bf36125d8498e2a /src/nshd/hackers_git/hackers_watch.go | |
parent | 0adc8879233bfb020259ebb43e33a35c5b00a8f1 (diff) |
The comment at the bottom of hackers_watch.go was wrong; fix the race.
The actual determinant was this race
main worker
-------------------
Close() Read()
Exit()
If Read() returned between when Close() happened and when Exit() happened,
then the code ran.
It doesn't *really* matter if the code runs, but for predictability, set up
a wait group to have Close() block until the worker exits.
Diffstat (limited to 'src/nshd/hackers_git/hackers_watch.go')
-rw-r--r-- | src/nshd/hackers_git/hackers_watch.go | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/nshd/hackers_git/hackers_watch.go b/src/nshd/hackers_git/hackers_watch.go index 87c856d..9592dab 100644 --- a/src/nshd/hackers_git/hackers_watch.go +++ b/src/nshd/hackers_git/hackers_watch.go @@ -181,9 +181,5 @@ func (o *Hackers) worker() { } } } - // This happens only sometimes--depending on if the main - // goroutine or this goroutine is killed by os.Exit first; - // this happens if the main goroutine calls inotify.Close() - // before this groutine is killed. - logger.Info("Stopping hackers.git inotify watcher") + logger.Info("Stopped hackers.git inotify watcher") } |