Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do you insert data into the channel and take it out immediately? What's the effect? #13

Open
1325075688gw opened this issue Dec 8, 2021 · 2 comments

Comments

@1325075688gw
Copy link

worker.stop <- struct{}{}

@valiner
Copy link

valiner commented Aug 17, 2023

wait worker stop task(Maybe it's a time-consuming stop) like

                            case <-w.stop:
                                // do somethine
				w.stop <- struct{}{}
				return

@shgopher
Copy link

The previous sending and receiving operation is to transmit the signal to start the stop, and the following sending and receiving operation is to complete the execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants