On Sun, May 27, 2018 at 10:03:32PM -0700, Daniel Austin 
<daniel.r.aus...@gmail.com> wrote:
> Hi.  What is the proper mechanism to trigger an event in a separate
> process, not a separate thread, assuming a modern Linux kernel?
> 
> 1) Use ev_io on an eventfd file descriptor.  Use normal eventfd file

That, or a pipe, are the most reasonable options. Which one is faster
depends very much on the application.

> "register" with the triggering process, but they do need to get access to
> the file description number somehow (e.g. shared memory or other means).

The fd number is useless in another process - you cna pass file
descriptions to other pĆ¼rocesses with file descriptor passing via a unix
domain socket, though, or inheriting using fork for example.

> 2) Use ev_async.  I think the proper usage here would be to put the

ev_async cannot be used for this purpose.

> 3) Something else?

Use inotify to watch for file changes. There are some other mechanisms,
but for general event handling, you want a pipe or something like eventfd.

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

_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev

Reply via email to