summaryrefslogtreecommitdiff
path: root/src/ae.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ae.c')
-rw-r--r--src/ae.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ae.c b/src/ae.c
index 1bf6cbfbf..7aa204250 100644
--- a/src/ae.c
+++ b/src/ae.c
@@ -428,6 +428,9 @@ int aeProcessEvents(aeEventLoop *eventLoop, int flags)
tvp = &tv;
}
+ if (eventLoop->beforesleep != NULL)
+ eventLoop->beforesleep(eventLoop);
+
/* Call the multiplexing API, will return only on timeout or when
* some event fires. */
numevents = aeApiPoll(eventLoop, tvp);
@@ -522,8 +525,6 @@ int aeWait(int fd, int mask, long long milliseconds) {
void aeMain(aeEventLoop *eventLoop) {
eventLoop->stop = 0;
while (!eventLoop->stop) {
- if (eventLoop->beforesleep != NULL)
- eventLoop->beforesleep(eventLoop);
aeProcessEvents(eventLoop, AE_ALL_EVENTS|AE_CALL_AFTER_SLEEP);
}
}