(ctx context.Context)
| 295 | } |
| 296 | |
| 297 | func (s *sampleServiceWithStopInit) Start(ctx context.Context) error { |
| 298 | ctx, shouldStart, started, stopped := s.StartInit(ctx) |
| 299 | if !shouldStart { |
| 300 | return nil |
| 301 | } |
| 302 | |
| 303 | go func() { |
| 304 | started() |
| 305 | defer stopped() |
| 306 | s.state = true |
| 307 | <-ctx.Done() |
| 308 | }() |
| 309 | |
| 310 | return nil |
| 311 | } |
| 312 | |
| 313 | func (s *sampleServiceWithStopInit) Stop() { |
| 314 | shouldStop, stopped, finalizeStop := s.StopInit() |