C++ How TO?
Hongli Lai
hongli at phusion.nl
Thu Dec 9 10:35:42 CET 2010
Use ev::dynamic_loop or ev::default_loop.
On Thu, Dec 9, 2010 at 10:28 AM, Praveen Baratam
<praveen.baratam+libev at gmail.com> wrote:
> Hello All,
> I am an absolute new comer to Libev and trying to use its c++ binding inside
> my code.
> There are very examples related to C++ binding.
> All I can find was -
>
> class myclass
> {
> ev::io io ; void io_cb (ev::io &w, int revents);
> ev::io2 io2 ; void io2_cb (ev::io &w, int revents);
> ev::idle idle; void idle_cb (ev::idle &w, int revents);
>
> myclass (int fd)
> {
> io .set <myclass, &myclass::io_cb > (this);
> io2 .set <myclass, &myclass::io2_cb > (this);
> idle.set <myclass, &myclass::idle_cb> (this);
>
> io.set (fd, ev::WRITE); // configure the watcher
> io.start (); // start it whenever convenient
>
> io2.start (fd, ev::READ); // set + start in one call
> }
> };
>
> I am wondering how to instantiate a loop in C++ and how to pass that loop to
> the ev::io constructor. The documentation says ev::io(loop) but this is not
> very helpful regarding the type of the object that needs to be passed to the
> constructor.
> Some body please help me.
> Thank you.
> _______________________________________________
> libev mailing list
> libev at lists.schmorp.de
> http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
>
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: info at phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)
More information about the libev
mailing list