As for mixing with HelperThreads, it is completely orthogonal to what I
am suggesting. Although LuaSocket is not completely thread-safe, it can
be made so with just a little work.
I see that HelperThreads can, e.g., take a Lua file handle (FILE *)
and use it in a non-blocking way using threads. This is something a
Windows IOCP library couldn't do.
I note that the libevent API is based on (fd and timeval) callbacks,
whereas IOCP is based on polling (GetQueuedCompletionStatus). I.e.,
the dispatcher is built outside library in my IOCP approach, whereas
it is inside the library in libevent. Which approach do you prefer?