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

Finaliser for pool gc #150

Closed
rekby opened this issue Mar 10, 2022 · 1 comment
Closed

Finaliser for pool gc #150

rekby opened this issue Mar 10, 2022 · 1 comment

Comments

@rekby
Copy link
Member

rekby commented Mar 10, 2022

func (p *pool) Release(ctx context.Context) error {

I think about counter with implicit close object when counter = 0 is un-intuitive.

What about:

  1. Write separate method Close() - for close logic and call it when close needed
  2. Use runtime.SetFinalizer - for call implicit Close() if pool doesn't need
  3. Add Hook OnClosed - can help determine call in tests example
@asmyasnikov
Copy link
Member

all places for release pool are known. No need to use runtime.SetFinalizer

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

2 participants