No fork() involved actually. Here is an example code #include1.c
void func1() { struct event ev; event_set(&ev, /*udp socket*/); event_add(ev, NULL); } #include2.c void func2() { struct event ev; event_set(&ev, /*tcp socket*/); event_add(&ev, NULL); } #main.c int main() { event_init(); func1(); func2(); event_dispatch(); } Both are setup using EV_READ | EV_PERSIST... again, UDP works fine, but TCP segfaults. I have to maintain a few servers running this program so I'd like to be able to use the distributed lib instead of having to maintain my own builds across multiple platforms. And with this working fine by doing all of event_init() event_dispatch() in each function (doing the event setup within it's own thread for the TCP socket) both servers worked fine. It's only when I try to implement them both together in what appears to be a proper implementation that I get this error. Thank you, -brian On Fri, Mar 6, 2009 at 3:20 AM, Niels Provos <pro...@gmail.com> wrote: > On Thu, Mar 5, 2009 at 9:10 AM, Brian <ping...@gmail.com> wrote: >> I have a thread safe application that I am using to host a UDP service >> on. This program also has a TCP based admin process to grab stats and >> update internals for the program during run-time. Before I had >> event_init() event_dispatch() running in their own threads, but I >> wanted to make things more proper. So in main() I have event_init() >> and event_dispatch() while performing event_set() and event_add() in >> their own respected processes. This has structure has multiple >> benefits for me. I am on an Ubuntu feisty install. Everything still >> works with UDP perfectly, however when I attempt to connect to the TCP >> port epoll_dispatch() SIGSEGV's > > When you say in "in their own respected processes", does that mean you > fork? After fork you need to call event_reinit() to setup the epoll > structures again. The epoll fd does not survive across forks. You > will have to upgrade to libevent-1.4.x for that. > > Niels. > _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users