bbgo_origin/pkg/bbgo/graceful_callbacks.go

19 lines
356 B
Go
Raw Normal View History

2020-11-12 06:50:08 +00:00
// Code generated by "callbackgen -type Graceful"; DO NOT EDIT.
package bbgo
import (
"context"
"sync"
)
2022-07-19 09:13:35 +00:00
func (g *Graceful) OnShutdown(cb ShutdownHandler) {
2020-11-12 06:50:08 +00:00
g.shutdownCallbacks = append(g.shutdownCallbacks, cb)
}
func (g *Graceful) EmitShutdown(ctx context.Context, wg *sync.WaitGroup) {
for _, cb := range g.shutdownCallbacks {
cb(ctx, wg)
}
}