diff options
author | antirez <antirez@gmail.com> | 2017-07-11 00:13:52 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2017-07-11 00:13:52 +0200 |
commit | 54e4bbeabdd1cd92e5c2b461f85c6c03d8645838 (patch) | |
tree | 9cd9d8021aeab6dd2cd7242d08cc3b8bf84549a0 /src/ae.h | |
parent | 11182a1a58ef6d36f76f7a5e06d0598254b524d9 (diff) | |
download | redis-54e4bbeabdd1cd92e5c2b461f85c6c03d8645838.tar.gz |
Event loop: call after sleep() only from top level.
In general we do not want before/after sleep() callbacks to be called
when we re-enter the event loop, since those calls are only designed in
order to perform operations every main iteration of the event loop, and
re-entering is often just a way to incrementally serve clietns with
error messages or other auxiliary operations. However, if we call the
callbacks, we are then forced to think at before/after sleep callbacks
as re-entrant, which is much harder without any good need.
However here there was also a clear bug: beforeSleep() was actually
never called when re-entering the event loop. But the new afterSleep()
callback was. This is broken and in this instance re-entering
afterSleep() caused a modules GIL dead lock.
Diffstat (limited to 'src/ae.h')
-rw-r--r-- | src/ae.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -46,6 +46,7 @@ #define AE_TIME_EVENTS 2 #define AE_ALL_EVENTS (AE_FILE_EVENTS|AE_TIME_EVENTS) #define AE_DONT_WAIT 4 +#define AE_CALL_AFTER_SLEEP 8 #define AE_NOMORE -1 #define AE_DELETED_EVENT_ID -1 |