struct sockitem* NewSockItem(int sockfd, CallBack cb) {
struct sockitem *si = (struct sockitem*)malloc(sizeof(struct sockitem));
si->sockfd = sockfd;
si->callback = cb;
return si;
}
struct epoll_event ev;
ev.events = EPOLLIN | EPOLLET;
ev.events.ptr = NewSockItem(clientfd, recv_cb);
epoll_ctl(eventloop->epfd, EPOLL_CTL_ADD, clientfd, &ev);
when build, error happens like this:
use ev.data.ptr, not ev.events.ptr
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.