From 4cfe004801a145e48f1dc31e5300efe28ba8fb21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Mon, 27 Aug 2007 17:06:09 +0000 Subject: [PATCH] add support for DISPATCH_PRI (EPOLLPRI) --- dispatch.c | 19 ++++++++++--------- dispatch.h | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dispatch.c b/dispatch.c index 37264a8f..427dc1a4 100644 --- a/dispatch.c +++ b/dispatch.c @@ -161,6 +161,9 @@ dispatch_set(void *handle, int flags) { struct epoll_entry *e = handle; + if(flags & DISPATCH_PRI) + e->event.events |= EPOLLPRI; + if(flags & DISPATCH_READ) e->event.events |= EPOLLIN; @@ -176,6 +179,9 @@ dispatch_clr(void *handle, int flags) { struct epoll_entry *e = handle; + if(flags & DISPATCH_PRI) + e->event.events &= ~EPOLLPRI; + if(flags & DISPATCH_READ) e->event.events &= ~EPOLLIN; @@ -238,16 +244,11 @@ dispatcher(void) if(e->callback == NULL) continue; /* poll entry has been free'd during loop */ - e->callback( - ((events[i].events & (EPOLLERR | EPOLLHUP)) ? + e->callback(((events[i].events & (EPOLLERR | EPOLLHUP)) ? DISPATCH_ERR : 0 ) | - - ((events[i].events & EPOLLIN) ? - DISPATCH_READ : 0 ) | - - ((events[i].events & EPOLLOUT) ? - DISPATCH_WRITE : 0 ), - + ((events[i].events & EPOLLIN) ? DISPATCH_READ : 0 ) | + ((events[i].events & EPOLLOUT) ? DISPATCH_WRITE : 0 ) | + ((events[i].events & EPOLLPRI) ? DISPATCH_PRI : 0 ), e->opaque, e->fd); } diff --git a/dispatch.h b/dispatch.h index b1e82d05..6e9d8653 100644 --- a/dispatch.h +++ b/dispatch.h @@ -22,6 +22,7 @@ #define DISPATCH_READ 0x1 #define DISPATCH_WRITE 0x2 #define DISPATCH_ERR 0x4 +#define DISPATCH_PRI 0x8 int dispatch_init(void); void *dispatch_addfd(int fd,