On Tue, Mar 26, 2013 at 10:04 AM, Azat Khuzhin <dohardgo...@gmail.com>wrote:

> Hi,
>
> On Tue, Mar 26, 2013 at 2:22 AM, sven falempin <sven.falem...@gmail.com>
> wrote:
> > using libevent2 (libevent-2.0.21-stable) i create this log:
> >
> > [warn] event_del: event has no event_base set.
> > [err] event_assign called on an already added event 0x84de9e4 (events:
> 0x0,
> > fd: 0, flags: 0x0)
> >
> > using this code:
> >
> > void connection::listen_write_event() {
> >   int rc = 0;
> >   if (fd == -1) return;
> >   if (is_listening_write) return;
> >   is_listening_write = 1;
> > #ifdef DEBUG
> >       fprintf(stderr,"%d:%08X, LISTEN WRITING\n",fd, (unsigned
> > int)pthread_self());
> > #endif
> >   event_del(&_sock_ev_write);
>
> What is "_sock_ev_write" how you initialize it?
> On stack I suppose?
>
> Why do you call event_del() if you don't set event_base for it?
> You install base, on the next line.
>

_sock_ev_write is a member of connection.

each client get a connection object created.
the program listen the write event after having writing to socket.
so i delete the event set the previous time.

i do not want use EV_PERSIST (because i read in another thread)



> >   rc = event_assign(&_sock_ev_write, s->get_evt_base(),
> >     fd, EV_WRITE,
> >     server::con_ready_pattern, this);
> >   if (rc == 0)
> >     event_add(&_sock_ev_write, NULL);
> >   else
> >     syslog( LOG_CRIT, "%d:cannot create write event",fd);
> > }
> >
> > i cannot supress the warn even if i put an event base (probably
> > missunderstood the doc)
>
> Did saw this? It has all that you need, for now, I think.
> http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html
>
> Never saw
i was used to libevent 1
when i switch to 2 i didnt saw the all buffered managment for multithreada
:-(


>  >
> > i declared
> > struct event_base * evt_base; as a global
> >
> > and get it init:
> >
> > #ifdef DEBUG
> >   event_enable_debug_mode();
> > #endif
> >   evthread_use_pthreads();
> >   gconf.evt_base = event_base_new();
> >   if ( gconf.evt_base == NULL ) {
> >     syslog( LOG_ERR, "cannot allocate base for %s:%d", gconf.ip,
> > gconf.port);
> >     return 1;
> >   }
> >
> > then used it everywhere
> >
> >
> > to create the bug i connect frenzy to the server using a while true;
> >
> > Notice: if the program do not close the FD i exhaust the files desc
> before
> > reaching the bug.
> >
> > --
> >
> ---------------------------------------------------------------------------------------------------------------------
> > () ascii ribbon campaign - against html e-mail
> > /\
>
>
>
> --
> Respectfully
> Azat Khuzhin
> Primary email a3at.m...@gmail.com
> ***********************************************************************
> To unsubscribe, send an e-mail to majord...@freehaven.net with
> unsubscribe libevent-users    in the body.
>



-- 
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail
/\

Reply via email to