Fwd: Driving a thread pool from libev

Marc Lehmann schmorp at schmorp.de
Sun Feb 15 01:34:02 CET 2015

On Sat, Feb 14, 2015 at 03:47:01PM +0100, Rick van Rein <rick at openfortress.nl> wrote:
> The ideal is to run this pthread_yield() once per thread, just before
> returning to poll() — calling it from every callback function is

And just before anybody reads this mail out of context - pthread_yield
will *not* give other threads opportunity to run in general, anywhere, and
on some systems (e.g. GNU/Linux) will temporarily give your thread lowest
priority in the system. You really do not want to implement this hack.

> This stuff is fun :-D

It's actually a bit painful...

> It’s a pitty libev doesn’t do all this yet though; it feels like a
> natural extension to me.

libev doesn't do that because it is horribly inefficient and broken by
design - libev shouldn't enforce an inefficient model, but allow users to
implement efficient ones themselves.

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

More information about the libev mailing list