]> granicus.if.org Git - libevent/commitdiff
It seems support for GetCompletionEventEx is not in my mingw. Use the simpler interf...
authorNick Mathewson <nickm@torproject.org>
Thu, 16 Apr 2009 00:27:32 +0000 (00:27 +0000)
committerNick Mathewson <nickm@torproject.org>
Thu, 16 Apr 2009 00:27:32 +0000 (00:27 +0000)
svn:r1175

event_iocp.c

index 8df1dd5d351193a2300a9214227e20abe6c8df5a..6e2db448d663141fab1e7c1ab241b4dd443025b6 100644 (file)
@@ -7,8 +7,6 @@
 #include "util-internal.h"
 #include "iocp-internal.h"
 
-#define N_OVERLAPPED_ENTRIES 32
-
 void
 event_overlapped_init(struct event_overlapped *o, iocp_callback cb)
 {
@@ -17,30 +15,28 @@ event_overlapped_init(struct event_overlapped *o, iocp_callback cb)
 }
 
 static void
-handle_entry(OVERLAPPED_ENTRY *ent)
+handle_entry(OVERLAPPED *o, ULONG_PTR completion_key, DWORD nBytes)
 {
        OVERLAPPED *o = ent->lpOverlapped;
        struct event_overlapped *eo =
            EVUTIL_UPCAST(o, struct event_overlapped, overlapped);
        eo = upcast(o, struct event_overlapped, overlapped);
-       eo->cb(eo, ent->lpCompletionKey, ent->dwNumberOfBytesTransferred);
+       eo->cb(eo, completion_key, nBytes);
 }
 
 static void
 loop(struct event_iocp_port *port, long ms)
 {
-       OVERLAPPED_ENTRY entries[N_OVERLAPPED_ENTRIES];
-       ULONG n_entries;
-       int i;
+       OVERLAPPED *overlapped;
+       ULONG_PTR key;
+       DWORD bytes;
 
        if (ms <= 0)
                ms = INFINITE;
 
-       while (GetQueuedCompletionStatusEx(port->port,
-               entries, N_OVERLAPPED_ENTRIES, &n_entries, ms, 1)) {
-               for (i = 0; i < n_entries; ++i) {
-                       handle_entry(&entries[i]);
-               }
+       while(GetQueuedCompletionStatus(port->port, &nBytes, &key,
+               &overlapped, ms)) {
+               handle_entry(overlapped, key, bytes);
        }
 }