On Jan 9, 2008 11:08 AM, Tony Arcieri <[EMAIL PROTECTED]> 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.
[EMAIL PROTECTED]
_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to