aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-08-31 12:58:37 +0200
committerMichael Muré <batolettre@gmail.com>2019-08-31 12:58:37 +0200
commitc4accf5525e1a8247d15c7122a8c54fa5d34f9d2 (patch)
tree19a1a0770bb951bba6744f626e6396a790971fdd /util
parentcb204411a26279b91e60ac41080c674981d90353 (diff)
downloadgit-bug-c4accf5525e1a8247d15c7122a8c54fa5d34f9d2.tar.gz
interrupt: also protect cancel with the mutex
Diffstat (limited to 'util')
-rw-r--r--util/interrupt/cleaner.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/interrupt/cleaner.go b/util/interrupt/cleaner.go
index 42f925c4..38c8425b 100644
--- a/util/interrupt/cleaner.go
+++ b/util/interrupt/cleaner.go
@@ -33,7 +33,12 @@ func RegisterCleaner(cleaner CleanerFunc) CancelFunc {
defer mu.Unlock()
w := &wrapper{f: cleaner}
- cancel := func() { w.disabled = true }
+
+ cancel := func() {
+ mu.Lock()
+ defer mu.Unlock()
+ w.disabled = true
+ }
// prepend to later execute then in reverse order
cleaners = append([]*wrapper{w}, cleaners...)