mailru / easygo

Tools for building go apps.
MIT License
673 stars 124 forks source link

Why not use goroutines when dispatch callbacks? #14

Open AsterDY opened 5 years ago

AsterDY commented 5 years ago

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 commented 5 years ago

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.