From f14479c796fbf00c41ceefdcb4bec04df46f53ce Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 21 Nov 2011 16:05:29 +0100 Subject: [PATCH] new ae.c API to get current events by file descriptor. --- src/ae.c | 7 +++++++ src/ae.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/ae.c b/src/ae.c index c7918ee1..05802890 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 a9db18ed..9e23a6fd 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); -- 2.45.2