mailru / easygo

Tools for building go apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why not use goroutines when dispatch callbacks?

AsterDY opened this issue · comments

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.

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.