At Sat, 22 Apr 2006 02:50:25 -0700, [EMAIL PROTECTED] wrote:
> 
> Richard,
> 
> > Make the socket you accept on non blocking and register a read
> > callback for it. Accept new connections in the callback.
> 
> Yes, I can do this, but maybe a better way is to (yes, John finally
> read _that_ part of the man page <smile>) use event_loop() and write
> my own loop surrounding it, instead of using event_dispatch() with
> its' own loop?  Or maybe I misunderstood the man page (wouldn't be
> the first time _that_ has happened <shrug>) :-)
> 

Ask yourself why you use libevent :)

If I understand you correctly (which I quite possibly don't) you propose
something like this:

for(;;) {
    accept_new_connections(); /* Doesn't block */
    event_loop(EVLOOP_NONBLOCK);
}

But this negates the point of libevent since you're now polling for
events in a loop (very inefficient). Instead, just let libevent tell you
when something of interest (such as write readiness or incoming connections)
happens.

Regards,
        -Richard
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to