hi,maybe you call event_new without the flag of EV_PERSISTENT,so when cb_func is triggered ,the event is automatic deleted by event_base_loop,it's seems there is two ev_del calls in your example , forgive my pool english..
2011/4/7 Michał Król <mhar...@gmail.com> > Hi, > > I was wondering if there is any way I can access event object within > callback function in libevent2? I know I can put it in global variable, but > I'll have a lot of events and I want to access particular one, so I want to > avoid it. > > I cannot pass it as an argument because I'll have pointer to event > structure after setting callback in evet_new. > > To be precise I want to do something like this: > > > int main(){ > event = event_new(base, socket, flags, cb_func, args); > > event_add(event); > } > > void cb_func(args){ > > //do some work > > event_del(event); <-- the problem is with getting event structure > which invoked this callback } > > > Thanks in advance > > Michal > > > >