3 ms·
And select() is still a perfectly good option for situations where the number of FDs involved is constant, or at least stays small. For instance: for networking
by duskwuff 10y ago
And select() is still a perfectly good option for situations where the number of FDs involved is constant, or at least stays small. For instance: for networking in an X11 application, using a select()-based event loop is much simpler than creating a thread for each socket.
- ktRolster 10y agoAnd even when the number of FDs grow large, epoll() (which is like select()) in Linux is often preferable spawning threads.
- jwatte 10y agoYou should never, ever, create one thread per socket. The choice is between select, polled IO, or events. Sadly, UNIX doesn't have a good unified asynchronous IO model, like OVERLAPPED and IOCP on NT.
- snnn 10y ago> You should never, ever, create one thread per socket Really? that's how MySQL works.