summaryrefslogtreecommitdiff
path: root/event_iocp.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-04-16 00:27:32 +0000
committerNick Mathewson <nickm@torproject.org>2009-04-16 00:27:32 +0000
commit09c23b6a5679b1a4a871bdd3143e615209aac05d (patch)
tree511d95bfe17df072faa9d445201a3a05d2134cf3 /event_iocp.c
parent93d4f884aa2f42d832b4fefa0fe4d39bb0098750 (diff)
downloadlibevent-09c23b6a5679b1a4a871bdd3143e615209aac05d.tar.gz
It seems support for GetCompletionEventEx is not in my mingw. Use the simpler interface instead, for now.
svn:r1175
Diffstat (limited to 'event_iocp.c')
-rw-r--r--event_iocp.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/event_iocp.c b/event_iocp.c
index 8df1dd5d..6e2db448 100644
--- a/event_iocp.c
+++ b/event_iocp.c
@@ -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);
}
}