In order to use libaio with epoll event loop use eventfd(2). With eventfd you create a descriptor and add it to epoll to observe and to libaio to notify when it has some events. Excerpt from source below
if ((afd = eventfd()) == -1) goto err_end; ... io_set_eventfd(&iocb, afd); ... ev.events = EPOLLIN | EPOLLET; ev.data.ptr = p; if (epoll_ctl(epollfd, EPOLL_CTL_ADD, afd, &ev) == -1) { log_syserr("epoll_ctl"); goto err_end; }Full source is available.
No comments:
Post a Comment