^_^ osdba ^_^
osdba
全部博文(150)
troubleshoot(13)
libevent(4)
socket(10)
plproxy(6)
PITR(2)
slony(2)
10.PostgreSQL开(3)
05.高可用(1)
04.问题处理(2)
03.调优(5)
01.入门(5)
02.日常管理(6)
2011年(2)
2010年(139)
2009年(9)
platinal
jinguand
大鬼不动
liu4356
brjl
sunyunxi
yxw98092
qingyang
lhrbest
yueli33
aasdba
desert_x
分类: C/C++
2010-10-02 21:15:39
#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <event.h> void time_cb(int fd, short event, void *arg) { struct timeval tv; struct event *ev = NULL; // add your code here fprintf(stderr, "Hello, evtimer\n"); ev = malloc(sizeof(struct event)); tv.tv_sec = 0; tv.tv_usec = 50000L; evtimer_set(ev, time_cb, ev); evtimer_add(ev, &tv); } int main(int argc, char *argv) { struct timeval tv; struct event *ev = NULL; event_init(); ev = malloc(sizeof(struct event)); tv.tv_sec = 0; tv.tv_usec = 50000L; evtimer_set(ev, time_cb, ev); evtimer_add(ev, &tv); event_dispatch(); return 0; }
上一篇:红黑树的实现(C++)
下一篇:libevent之signal试用
登录 注册