...
class IOLoop(Configurable):
"""A level-triggered I/O loop.
We use `epoll` (Linux) or `kqueue` (BSD and Mac OS X) if they
are available, or else we fall back on select(). If you are
implementing a system that needs to handle thousands of
simultaneous connections, you should use a system that supports
either `epoll` or `kqueue`.
...
可以去看
tornado
的ioloop
模块。里面有说明在
Linux
系统中用epoll
,BSD
或Mac OS X
用kqueue
,其他系统中用select
。使用的是
python
标准库中的select
模块。实际上select
模块也只是对系统的select
的调用,并没有自己实现。想深入研究的话可以看源码
感谢 @依云 的补充。
python
标准库中的select
模块是对系统各种I/O
复用方案的封装。