For what it's worth, although solution 3 is not very pretty, it could
be done with a simple change to the documentation stating that one
should call #rewind to insure resources are released (or let the
enumerator fall out of scope so the GC takes care of it). When an
enumerator is rewound, implementations are free to stop the associated
thread. Of course, if a subsequent call to #next is made, a new one
needs to be started (so a small delay might be in order before
shutting down the thread, etc...)

I'm curious as to what are good examples of uses of #next. Personally,
I don't mind the fact that its use comes with a big warning "might be
slow or unsupported".

On Fri, Sep 25, 2009 at 4:29 PM, Charles Oliver Nutter
<headius / headius.com> wrote:
> Here's the options as I see them:
> ...
> 3. Provide a way to cancel an enumeration, so implementations like
> JRuby will know when to forcibly end the fiber/thread
> ...