libev
WARNING: This is limited to network sockets in Windows, and then only if embedded. It seems having a unified event driven system for timers/sockets/etc isn't going to work quite right.
libev is a cross-platform library for events. Events are a way to call functions when an interesting "event" happens, such as a file being written to, timer expiring, or a network packet being received on a network socket.
On Windows (therefore, MinGW), libev is only supported by embedding into a project.
libev home page: http://software.schmorp.de/pkg/libev.html
See the full documentation here: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod
Prerequisites
Install MSYS + MinGW.
Install 7zip.
Download source
Download libev: Version 3.9
mkdir $HOME/libev
Extract libev-3.9/ as a directory to $HOME/libev/
Patch the source code
Version 3.9 has some small bugs in it's WIN32 support. See this thread.
These have been patched in the development version.
Make these changes to libev-3.9/ev.c:
Line 510:
# define EV_WIN32_HANDLE_TO_FD(handle) _open_osfhandle (handle, 0)
Line 969:
return EV_FD_TO_WIN32_HANDLE (fd) != -1;
Line 1184:
ioctlsocket (EV_FD_TO_WIN32_HANDLE (fd), FIONBIO, &arg);
Embedding to a project
TODO
Build (Unix/Cygwin only!!)
Start the MinGW Shell
cd libev
libev-3.9/configure --prefix=/mingw
make
Install (Unix/Cygwin only!!)
make install
What was installed?
/usr/local/include/
event.h
ev.h
ev++.h
/usr/local/lib/
libev.la
libev.a
/usr/share/man/man3/
ev.3
Uninstall
Start the MinGW Shell
cd libev/
make uninstall