bbgo_origin/pkg/bbgo/graceful_callbacks.go

19 lines
386 B
Go
Raw Permalink 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"
)
func (g *Graceful) OnShutdown(cb func(ctx context.Context, wg *sync.WaitGroup)) {
g.shutdownCallbacks = append(g.shutdownCallbacks, cb)
}
func (g *Graceful) EmitShutdown(ctx context.Context, wg *sync.WaitGroup) {
for _, cb := range g.shutdownCallbacks {
cb(ctx, wg)
}
}