On Sat, Apr 19, 2008 at 12:23:16AM +0200, Springande Ulv wrote:
> 
> On 18. april. 2008, at 22.36, Cezary Rzewuski wrote:
> >>our best bet is to use a single thread using
> >>libevent, or go totally multi-threaded without libevent. In 90% of  
> >>the
> >>circumstances one of those options (though not both)
> 
> Why not both?! Using both threads _and_ libevent is not only possible  
> both often feasible. Use libevent in a i/o bound thread and a thread  
> pool for CPU bound operations. In a network application the network is  
> the bottleneck and a few context switches is diminutive in this context.

Because _unless_ you can justify the additional complexity, why bother?

In some sense--like code complexity--using both an event-oriented design
*and* threads is the worst of both worlds. Your processing logic is turned
inside-out (state machines, etc, can be confusing to some people), plus you
have mutexes and barriers and all that crap littered throughout your code.

I've used libevent with threads. I've also used libevent with multi-process
configurations. But, usually I stick with one or the other. Premature
optimization is the root of all evil....

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

Reply via email to