C++ APIs [Re: libevent-like callback in c++]

Tony Arcieri tony at clickcaster.com
Fri Jan 11 04:00:23 CET 2008


On Jan 9, 2008 11:08 AM, Tony Arcieri <tony at clickcaster.com> wrote:

> This is what I ended up doing in the Ruby binding.  The Watcher base class
> cannot be instantiated directly, instead only the subclasses can.  Each
> subclass implements attach and detach methods to add and remove it from a
> loop.
>

Let me also say: this approach has been incredibly successful in building a
simple Reactor framework.

I've just kept subclassing from there.  I built a BufferedIO class on top of
IOWatcher, built Socket (and a TCPSocket subclass) on top of BufferedIO, and
have since built even higher level abstractions on top of TCPSocket.

Every object in the Reactor framework is ultimately subclassed from the
abstract Watcher base class, and all support the attach/detach methods.

-- 
Tony Arcieri
ClickCaster, Inc.
tony at clickcaster.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.schmorp.de/pipermail/libev/attachments/20080110/dbb47ce2/attachment.htm 


More information about the libev mailing list