1.5 KiB
wepoll - epoll for windows
This library implements the epoll API for Windows applications. It attempts to be efficient, and to match the Linux API and as closely as possible.
Rationale
Unlike Linux, OS X, and many other operating systems, Windows doesn't
have a good API for receiving socket state notifications. It only
supports the select and WSAPoll APIs, but they
don't scale
and suffer from
other issues.
Using I/O completion ports isn't always practical when software is designed to be cross-platform. Wepoll offers an alternative that is much closer to a drop-in replacement for software that was designed to run on Linux.
Features
- can poll 100000s of sockets efficiently
- fully thread safe
- multiple threads can poll the same epoll port
- sockets can be added to multiple epoll sets
- polling for
EPOLLIN,EPOLLOUT,EPOLLPRI,EPOLLRDHUP,EPOLLHUP, andEPOLLERRevents EPOLLONESTHOTflag
Limitations
- only works with sockets
- some modes not suported:
EPOLLET,EPOLLEXCLUSIVE
How to use
The library is distributed as a single source file (wepoll.c) and a single header file (wepoll.h). Compile the .c file as part of your project, and include the header wherever needed.
Compatibility
- Requires Windows 7 or higher.
- Can be compiled with recent versions of MSVC and Clang.
- GCC (mingw) should work (but is untested).
Compatibility notes
TODO