[ANN] Ebb Web Server

Marc Lehmann schmorp at schmorp.de
Mon Apr 7 14:59:12 CEST 2008

On Fri, Apr 04, 2008 at 12:00:18PM -0600, Tony Arcieri <tony at medioh.com> wrote:
> > the sense of: even though many people might use it, it is fine io have
> > suboptimal solutions for it).
> >
> That's pretty much my attitude about it as well.

I'd say that's healthy, but for performance reasons, they might come back
(perl coroutine switches are an order of magnitutde faster than linux
thread switch time, so coroutines could make a lot of sense, especially as
ruby abuses native threads as coroutines anyway).

(Probably it's just idle talk by some people I stumbled upon, but native
threads are usually way slower than a well-crafted coroutine system).

> Revactor, the Actor library I wrote, uses a coroutine system in which the
> coroutines are suspended by waiting for asynchronous messages.  The event
> system (using Rev) feeds asynchronous messages to the coroutines.

Yeah, I saw that, very nice, right conceptual model for those cases where
the overhead doesn't matter (which imho is almost all).

In fact, one of the design principles behind libev was to make libev
coroutine-safe, in the sense that you can switch to other coroutines from
a handler and even recursively enter ev_loop. Event, a commonly used event
library for perl, is threadsafe, but not coroutine-safe (a common theme
to glib and many other event libs, too), which means that one has to
queue events received from event handlers and execute them outside of the
callback context. Very annoying.

And I always assumed being threadsafe means being coroutine safe
as well... (but I should have known, as threadsafe does not mean
signal-contetx safe either).

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list