I have 2 processes in my program, both use libevent.
I want to call event_base_free() in the child process to free parent's
event_base before
the next event_init() call. But this doesn't work correctly when using epoll
because listening
events of epolling descriptors are shared.
See my fix (hack?) for this.
Note that there is another bug in event_base_free() registered in libevent's
bug tracking
system (2012318):
https://sourceforge.net/tracker/index.php?func=detail&aid=2012318&group_id=50884&atid=461322
Alexander Drozdov
Index: epoll.c
===================================================================
--- epoll.c (revision 16306)
+++ epoll.c (revision 16307)
@@ -67,6 +67,7 @@
struct epoll_event *events;
int nevents;
int epfd;
+ pid_t pid;
};
static void *epoll_init (struct event_base *);
@@ -155,6 +156,7 @@
return (NULL);
}
epollop->nfds = nfiles;
+ epollop->pid = getpid();
evsignal_init(base);
@@ -346,7 +348,7 @@
if (needwritedelete)
evep->evwrite = NULL;
- if (epoll_ctl(epollop->epfd, op, fd, &epev) == -1)
+ if (epollop->pid == getpid() && epoll_ctl(epollop->epfd, op, fd, &epev)
== -1)
return (-1);
return (0);
_______________________________________________
Libevent-users mailing list
[email protected]
http://monkeymail.org/mailman/listinfo/libevent-users