Closed hzxuzhonghu closed 10 hours ago
This is the searching result.
https://github.com/search?q=repo%3Akmesh-net%2Fkmesh%20make(chan%20struct%7B%7D)&type=code
By passing stop channel to each module's Start/Run method, we can control each module globally. And even more, by doing so, we could further eliminate defer stop stuff
defer stop
c := controller.NewController(configs, bpfLoader.GetBpfKmeshWorkload(), configs.BpfConfig.BpfFsPath, configs.BpfConfig.EnableBpfLog) if err := c.Start(); err != nil { return err } log.Info("controller Start successful") defer c.Stop()
What about using context.WithCancel, it's a native way to simplify goroutine canceling.
/assign
No much difference, ctx also good
This is the searching result.
https://github.com/search?q=repo%3Akmesh-net%2Fkmesh%20make(chan%20struct%7B%7D)&type=code
By passing stop channel to each module's Start/Run method, we can control each module globally. And even more, by doing so, we could further eliminate
defer stop
stuff