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 not use goroutines when dispatch callbacks? #14

Open
AsterDY opened this issue Aug 9, 2019 · 1 comment
Open

Why not use goroutines when dispatch callbacks? #14

AsterDY opened this issue Aug 9, 2019 · 1 comment

Comments

@AsterDY
Copy link

AsterDY commented Aug 9, 2019

I see in the implementation of epoll.wait() and kqueue.wait() you use a iterative way to execute all the callbacks, why not use goroutines to concurrently execute them for more effitiency? I'm just a little confused about it. If you don't think this is neccessary, please tell me why, I will be very thankful.

@yushaolong10
Copy link

that's a good question.in my opinion, go-routine should be created in your own handler if you needed . Otherwise that will cause go-routine uncontrollable. you can make routine-pool to limit it's max num if you want or just simple use go func() in callback.

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