Understood, the way i was doing it before behaved in the latter method
you described. I was just trying to get it to work in another way with
only one dispatcher.
But everything should be alright doing it the way i have been where
the dispatcher is in the same thread as event structures are setup
On Fri, Mar 06, 2009 at 09:16:26AM -0500, Brian wrote:
> Thanks Guillaume for the feedback. Unfortunately malloc/calloc method
> didn't work for me. I think I will just go back to how it was. Does
> anyone know if there is an inherent flaw, perhaps, with doing the
> event_init()/event_dispatch() wi
On Fri, Mar 6, 2009 at 09:16, Brian wrote:
> Thanks Guillaume for the feedback. Unfortunately malloc/calloc method
> didn't work for me. I think I will just go back to how it was. Does
> anyone know if there is an inherent flaw, perhaps, with doing the
> event_init()/event_dispatch() within a posi
Thanks Guillaume for the feedback. Unfortunately malloc/calloc method
didn't work for me. I think I will just go back to how it was. Does
anyone know if there is an inherent flaw, perhaps, with doing the
event_init()/event_dispatch() within a posix thread?
-brian
On Fri, Mar 6, 2009 at 8:59 AM,
hmmm, you should not take a reference to stack auto-allocated objects
that crosses function boundaries
Hence, two solutions at first glance:
- make these two static and move them out of function bodies
- allocate them on the heap using malloc/calloc and don't forget to
free at the end
Guillaume
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()
When I'm running my libevent based application under valgrind I'm
getting messages about memory access violations in epoll.c. when
changing line 125 from:
nfiles = rl.rlim_cur - 1;
to:
nfiles = rl.rlim_cur;
then the application runs with no complains from valgrind. The problems
shows when reach