rework module shutdown process to cancel module context in defer

This commit is contained in:
Joel Wetzell
2026-05-27 20:50:33 -05:00
parent 52ca801fbd
commit 0b494fce91
21 changed files with 197 additions and 216 deletions
+2 -3
View File
@@ -83,17 +83,16 @@ func (mi *MIDIInput) Start(ctx context.Context, inputHandler common.InputHandler
mi.stop = stop
<-mi.ctx.Done()
mi.logger.Debug("done")
return nil
}
func (mi *MIDIInput) Stop() {
if mi.cancel != nil {
mi.cancel()
defer mi.cancel()
}
if mi.stop != nil {
mi.stop()
mi.stop = nil
}
midi.CloseDriver()
mi.logger.Debug("done")
}