What is Windows\' best I/O event notification facility?
By best I mean something that ...
libuv
libuv
offers evented I/O for Unix and Windows and has support for socket, files and pipes. It is the platform layer of Node.js.
More details are at: http://nikhilm.github.io/uvbook/introduction.html
There isn't one yet, as far as I am aware. A friend and I are working on an open source Windows epoll implementation (link below) but we're running into issues figuring out how to make it act the same as the Linux implementation.
Current obstacles:
I'll try to come back and update this post as we make progress with the project.
http://sourceforge.net/projects/cpoll
select() function is POSIX and usable on windows including "winsock.h" or "winsock2.h".
In Windows, async operations are done by file operation, not by descriptor. There are several ways to wait on file operations to complete asynchronously.
For example, if you want to know when data is available on a network socket, issue an async read request on the socket and when it completes, the data was available and was retrieved.
In Win32, async operations use the OVERLAPPED structure to contain state about an outstanding IO operation.
MAXIMUM_WAIT_OBJECTS
objects at once (64). You can also wait on other types of events at the same time (process/thread termination, mutexes, events, semaphores)ReadFileEx
and WriteFileEx to queue Asynchronous Procedure Calls (APCs) to the calling thread and SleepEx (or WaitFor{Single|Multiple}ObjectsEx
) with Alertable TRUE
to receive a notification message for each operation when it completes. This method is similar to an IO completion port, but only works for one thread.
The Windows NT kernel makes no distinction between socket, disk file, pipe, etc. file operations internally: all of these options will work with all the file types.