Optimal multithread model

Marc Lehmann schmorp at schmorp.de
Mon Mar 15 13:58:34 CET 2010

On Mon, Mar 15, 2010 at 01:55:18PM +0100, Christophe Meessen <christophe at meessen.net> wrote:
> I finally found out how to implement the desired multi thread model by  
> using the existing API. One needs to use the ev_loop( ONE_SHOT) call.

I don't think one-shot will do what you want, one-shot runs the event loop
once, what you want is to invoke a single callback once.

You can, of course, do your own queueing from the callbacks, but as most
things thread, this will decrease efficiency further...

> complete request is obtained and then queues it for processing. This  
> would do the job nicely, though the overhead of the repeated call of  
> ev_loop is unknown.

The overhead of repeated calls to ev_loop is very low (just the function
call and a few tests).

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list