grim/convey

Simplify cleanup implementation.
cleanup-on-signal
2017-10-11, Eric Fritz
b42db46c6621
Parents 82ebdcf95c48
Children afcd5045ae1d
Simplify cleanup implementation.
--- a/cleanup/cleanup.go Wed Oct 11 22:05:18 2017 -0500
+++ b/cleanup/cleanup.go Wed Oct 11 22:09:42 2017 -0500
@@ -75,18 +75,11 @@
return func() { c.fire(name) }
}
-func (c *List) fire(name string) error {
+func (c *List) fire(name string) {
c.mutex.Lock()
- defer c.mutex.Unlock()
-
- fn, ok := c.funcs[name]
- if !ok {
- return errNoFunc
- }
-
- fn()
+ c.funcs[name]()
delete(c.funcs, name)
- return nil
+ c.mutex.Unlock()
}
func (c *List) run() {