#include <event.h>
struct event ev;
struct timeval tv; void time_cb(int fd, short event, void* argc)
{
printf("timer wakeup\n");
event_add(&ev, &tv);
} int main()
{
struct event_base*base = event_init();
tv.tv_sec = ;
tv.tv_usec = ;
evtimer_set(&ev, time_cb, NULL);
event_add(&ev, &tv);
event_base_dispatch(base);
return ;
}
注意编译的时候gcc -o * *.c -levent
需要加上-levent链接库