Permalink
Browse files

new ae.c API to get current events by file descriptor.

  • Loading branch information...
1 parent 51baa19 commit 713b4c5401a3f831bd04e43a39daa689d1411a64 @antirez committed Nov 21, 2011
Showing with 8 additions and 0 deletions.
  1. +7 −0 src/ae.c
  2. +1 −0 src/ae.h
View
@@ -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;
View
@@ -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);

0 comments on commit 713b4c5

Please sign in to comment.