Questions - partly newbie

Marc Lehmann schmorp at schmorp.de
Mon Jun 29 16:15:02 CEST 2015


On Mon, Jun 29, 2015 at 02:02:47PM +0200, "hard.one Software GmbH - Martin Peter Hanke" <mphanke at hardone-it.ch> wrote:
> >>The current architecture spawns a thread for the server, accepting
> >>connections in an own ev::default_loop.
> >
> >As a (likely unrelated) sidenote, ev::default_loop is undocumented
> >functionality - you can use it of course, but it can break or fail any
> >time.  Only the c++ watchers classes are currently documented.
> >
> Could you explain your statement a little more?
> Does this mean "I'm starting WW Z when using default_loop!" ?

ev::default_loop is a class inside the ev namespace in ev++.h, it's not
supported.

the default loop (as returned by e.g. ev_default_loop ()) is supported,
but not inside the ev namespace, as it's a C function. when including
ev++.h, you also get access to the ev_ functions, in the curren namespace.

> Or should I be using dynamic_loop instead?

What you should do is a big question. What you need to do to stay within
documented parameters is to use ev_default_loop() to get the default loop,
and ev_loop_new() and ev_loop_destroy() to get "dynamic" loops. They work
fine with the watcher classes in the ev namespace, e.g.:

   struct ev_loop *myloop = ev_loop_new (0);
   ev::io (myloop);

The rule would be to use the watcher classes in the namespace ev, and nothing
else form there, or in other words, anything that is odcumented in the libev
documentation.

-- 
                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