-
Notifications
You must be signed in to change notification settings - Fork 3
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
condchan: simplify ChanPool #1
Conversation
I should note that this implementation slightly weakens the “ That could be fixed (at a small cost in LoC) by changing the |
6a39ae9
to
8594b47
Compare
Can you describe that in a bit more detail? I don't see how it would work, since you can't select on a channel and a semaphore acquisition at the same time. (Or do you also mean spawning an extra goroutine per |
Thanks for this, btw! |
Hmm, good point. Will think a bit and get back to you. The cheating way to do it would be to store a |
The slightly-less-cheaty way to do it would be to add a |
Maybe we need |
I was wrong; it's actually shorter with |
That would be pretty dangerous: if the caller abandons the |
Hey, I like this one a lot more. Nice. |
Point made. We have some internal connection pools which use a pattern like this these days :) |
I do not guarantee that this is free from bugs, but the general idea should be sound.