Thanks for your support-your suggestion seems to work...

Despite the power and simplicity of the ev++.h API, I will have
trouble to keep using the libev at work for the time being and am
returning to libevent (with eventxx). As a partial workaround, I have
started a C++ compatibility API in an attempt to combine the best of
both worlds from ev++.h and libevent/eventxx.

My first 2 classes, ioevent and itimer, are meant to provide the most
important functions (start(), stop(), and set()) that had been missing
from the normal libevent and hence eventxx. I have also made a special
header, called "io++.h", to provide a very similar interface using
ev++.h. Hopefully, we will be able to really use the new ev++ API in
the future.

I started this as a fork of the eventxx project in the following
location: http://repo.or.cz/w/eventxx/ioevent.git

Any feedback would be appreciated at this point. I do have tests for
the most important functions, and I plan to test and flesh it out over
the coming days. I also have some other personal projects, for which I
can embed and test libev along with the C++ intefaces even more.

Thanks,
Chris

On Dec 12, 2007 4:16 AM, Marc Lehmann <[EMAIL PROTECTED]> wrote:
> [PS: I also sent a copy to the libev list as the libevent-like callback
> might be of interest to others, hope that was OK]
>
> On Tue, Dec 11, 2007 at 01:49:50PM +0100, Chris Brody <[EMAIL PROTECTED]> 
> wrote:
> > Much better, thank you!
>
> 1.8 should also have all these fixes, and of course a few others.
>
> > I am happy to see a normal "C function" callback as well. I still
> > stand by my earlier suggestion to allow a callback like: void func(int
> > fd, short ev, void * args)... since this would make a much quicker C++
> > drop-in replacement for libevent.
>
> you can add it yourself "easily", in pseudo-code:
>
>    struct my_io : ev::io
>    {
>      template<void (*function)(int, short, void *)>
>      void set (void *data = 0)
>      {
>        set_ (data, libevent_thunk<function>);
>      }
>
>      template<void (*function)(int, short, void *)>
>      static void libevent_thunk (EV_P_ ev_io *w, int revents)
>      {
>        function (w->fd, revents, w->data);
>      }
>    };
>
>    myio.set <my_cb> (mydata);
>
> all the goodies like inlining also apply to this, so there is, again very
> little overhead (actually none as if the callback-calling-code would be
> coded like in libevent (the ideal case for this example) it would still need
> to load fd and data even if not used.
>
> (if you use that, maybe I should rename the (currently internal) set_
> function to set_cb or something).
>
> --
>                 The choice of a       Deliantra, the free code+content MORPG
>       -----==-     _GNU_              http://www.deliantra.net
>       ----==-- _       generation
>       ---==---(_)__  __ ____  __      Marc Lehmann
>       --==---/ / _ \/ // /\ \/ /      [EMAIL PROTECTED]
>       -=====/_/_//_/\_,_/ /_/\_\
>

_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to