modelRT/real-time-data/anchor_param.go

31 lines
666 B
Go

// Package realtimedata define real time data operation functions
package realtimedata
import (
"context"
"modelRT/config"
"github.com/panjf2000/ants/v2"
)
// AnchorParamsChan define channel of component anchor param change
var AnchorParamsChan chan config.AnchorParamConfig
func init() {
AnchorParamsChan = make(chan config.AnchorParamConfig, 100)
}
// AnchorParamChangeChan define func of component anchor param change notification process
func AnchorParamChangeChan(ctx context.Context, pool *ants.PoolWithFunc) {
for {
select {
case <-ctx.Done():
return
case anchorParam := <-AnchorParamsChan:
pool.Invoke(anchorParam)
default:
}
}
}