自定义异步事件
struct event *ev = event_new(base, -1, EV_PERSIST, event_cb, NULL);
event_add(ev, NULL);
static void event_cb(int sock, short which, void *arg)
{
printf("%s\r\n",__func__);
}
event_active(ev , EV_SIGNAL, 0);
说明
- 触发后,不会马上同步调用回调,会在libevent循环后调用回调(异步)。