libev: notify only one process when multiple processes are listening socket

Marc Lehmann schmorp at schmorp.de
Tue Jul 16 19:17:02 CEST 2013


On Mon, Jul 15, 2013 at 05:18:33PM -0700, trafdev <trafdev at mail.ru> wrote:
> N-1 of them getting "resource temporaly unavailable (eagain) while
> accepting incoming connection, one wins and handles connection.
> 
> Is it possible to get notification on the socket descriptor only in
> one process and not waste resources of others?

Use some kind of exclusion mechanism so only one event loop has a watcher
active at a time, or use only a single shared event loop (e.g. in a
leader/follower configuration).

Libev or any lower levels cannot help you in this case, as they don't
know that your application is going to call accept multiple times in the
future.

-- 
                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