From f1f85f475d5f98ad9e9d574a11997c0829c3b189 Mon Sep 17 00:00:00 2001 From: Gaurav Singh Date: Fri, 22 May 2020 23:45:21 -0400 Subject: sentry: use defer wg.Done() unconditionally Signed-off-by: Gaurav Singh --- pkg/sentry/kernel/timekeeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } } -- cgit v1.2.3