summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-11-21 16:05:29 +0100
committerantirez <antirez@gmail.com>2011-11-21 16:05:29 +0100
commitf14479c796fbf00c41ceefdcb4bec04df46f53ce (patch)
treea815a0ed4919c79847ffcc853fc9a2ff9a3f9a09
parent491c1c4e044ac18c25905d3aba5c1578d6da7502 (diff)
downloadredis-f14479c796fbf00c41ceefdcb4bec04df46f53ce.tar.gz
new ae.c API to get current events by file descriptor.
-rw-r--r--src/ae.c7
-rw-r--r--src/ae.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/ae.c b/src/ae.c
index c7918ee1d..058028900 100644
--- a/src/ae.c
+++ b/src/ae.c
@@ -118,6 +118,13 @@ void aeDeleteFileEvent(aeEventLoop *eventLoop, int fd, int mask)
aeApiDelEvent(eventLoop, fd, mask);
}
+int aeGetFileEvents(aeEventLoop *eventLoop, int fd) {
+ if (fd >= AE_SETSIZE) return 0;
+ aeFileEvent *fe = &eventLoop->events[fd];
+
+ return fe->mask;
+}
+
static void aeGetTime(long *seconds, long *milliseconds)
{
struct timeval tv;
diff --git a/src/ae.h b/src/ae.h
index a9db18ed9..9e23a6fde 100644
--- a/src/ae.h
+++ b/src/ae.h
@@ -104,6 +104,7 @@ void aeStop(aeEventLoop *eventLoop);
int aeCreateFileEvent(aeEventLoop *eventLoop, int fd, int mask,
aeFileProc *proc, void *clientData);
void aeDeleteFileEvent(aeEventLoop *eventLoop, int fd, int mask);
+int aeGetFileEvents(aeEventLoop *eventLoop, int fd);
long long aeCreateTimeEvent(aeEventLoop *eventLoop, long long milliseconds,
aeTimeProc *proc, void *clientData,
aeEventFinalizerProc *finalizerProc);