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

feat: goroutine exits immediately #176

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

exfly
Copy link

@exfly exfly commented Jul 25, 2021


name: goroutine exits immediately
about: goroutine exits immediately, lazy init defaultAntsPool
title: 'goroutine exits immediately'
labels: ''
assignees: 'panjf2000'

1. Are you opening this pull request for bug-fixs, optimizations or new feature?

optimizations

First of all, thanks to ants for maintaining a good pool implementation. In the process of using it, it was found that some goroutines did not exit when Release was called. This mr change will cause all goroutines to exit immediately.
Except for the first time, the global defaultAntsPool will be created by default. In this mr, defaultAntsPool will be created the first time it is called.

2. Please describe how these code changes achieve your intention.

TODO

3. Please link to the relevant issues (if any).

TODO

4. Which documentation changes (if any) need to be made/updated because of this PR?

TODO

4. Checklist

  • I have squashed all insignificant commits.
  • I have commented my code for explaining package types, values, functions, and non-obvious lines.
  • I have written unit tests and verified that all tests passes (if needed).
  • I have documented feature info on the README (only when this PR is adding a new feature).

@exfly exfly marked this pull request as ready for review July 25, 2021 03:48
@exfly exfly changed the title feat: goroutine exits immediately DRAFT: feat: goroutine exits immediately Jul 25, 2021
@exfly exfly force-pushed the feat-goroutine-exits-immediately branch from 1b032ea to 12dd0ea Compare July 25, 2021 04:03
@exfly exfly changed the title DRAFT: feat: goroutine exits immediately feat: goroutine exits immediately Jul 25, 2021
@panjf2000
Copy link
Owner

It seems that you're trying to make the goroutine of purgePeriodically quit once the pool.Release() is called, however, what's wrong about this goroutine quitting only after all other worker goroutines quit?

@panjf2000 panjf2000 added the waiting for response waiting for the response from commenter label Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for response waiting for the response from commenter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants