when my multithread program run, a error thrown. I guess select() to have to manage file descriptor too much ,but not sure. Someone can explain to me. Thank you so much.
The problem is that select()
usually has built-in limit on filedescriptors it can manage (1024 on most systems). Try poll
or epoll
, that might help.
Also note that select()
uses unefficient algorithm to manage filedescriptors lookup. This algorithm has O(n) computational complecity, whilt epoll
has O(1).