summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGaurav Singh <gaurav1086@gmail.com>2020-05-22 23:45:21 -0400
committerGaurav Singh <gaurav1086@gmail.com>2020-06-09 22:56:39 -0400
commitf1f85f475d5f98ad9e9d574a11997c0829c3b189 (patch)
treea5d1d250f0eea6b06bbc6e6d963bf142a2bf8631
parent12f90947612bc5d1d7122871e8c7c1f6b9e4e303 (diff)
sentry: use defer wg.Done() unconditionally
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
-rw-r--r--pkg/sentry/kernel/timekeeper.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/sentry/kernel/timekeeper.go b/pkg/sentry/kernel/timekeeper.go
index da0ea7bb5..0adf25691 100644
--- a/pkg/sentry/kernel/timekeeper.go
+++ b/pkg/sentry/kernel/timekeeper.go
@@ -186,6 +186,7 @@ func (t *Timekeeper) startUpdater() {
timer := time.NewTicker(sentrytime.ApproxUpdateInterval)
t.wg.Add(1)
go func() { // S/R-SAFE: stopped during save.
+ defer t.wg.Done()
for {
// Start with an update immediately, so the clocks are
// ready ASAP.
@@ -220,7 +221,6 @@ func (t *Timekeeper) startUpdater() {
select {
case <-timer.C:
case <-t.stop:
- t.wg.Done()
return
}
}