摘要:
ae.c是redis事件框架的具体实现,这篇blog对这份源码进行简单说明。其中谈到了作者已经标记的一些未来可能做的改进。ae.c 1 #include <stdio.h> 2 #include <sys/time.h> 3 #include <sys/types.h> 4 #include <unistd.h> 5 #include <stdlib.h> 6 7 #include "ae.h" 8 #include "zmalloc.h" 9 #include "config.h&q 阅读全文
摘要:
ae框架是redis作者开发的事件处理框架,其目的和libevent项目类似。redis本着最小依赖原则,自己实现了一套,而且速度更快。ae只有不到500行代码,但据说libevent有3万加的代码,实现这一个功能所付出的代码量已经超过了redis所有的代码量。ae.h 1 #ifndef __AE_H__ 2 #define __AE_H__ 3 //同时支持的连接数,其实这个还是可以设的更大一些 4 #define AE_SETSIZE (1024*10) /* Max number of fd supported */ 5 6 #define AE_OK 0 7 #defi... 阅读全文